1 8 9 package com.sleepycat.je.tree; 10 11 import java.nio.ByteBuffer ; 12 13 import com.sleepycat.je.DatabaseException; 14 import com.sleepycat.je.dbi.DatabaseId; 15 import com.sleepycat.je.dbi.DatabaseImpl; 16 import com.sleepycat.je.log.LogEntryType; 17 import com.sleepycat.je.log.LogException; 18 import com.sleepycat.je.log.LogManager; 19 import com.sleepycat.je.log.LogReadable; 20 import com.sleepycat.je.log.LogUtils; 21 import com.sleepycat.je.log.LogWritable; 22 import com.sleepycat.je.log.LoggableObject; 23 24 28 public class INDeleteInfo 29 implements LoggableObject, LogReadable, LogWritable { 30 31 private long deletedNodeId; 32 private byte[] deletedIdKey; 33 private DatabaseId dbId; 34 35 38 public INDeleteInfo(long deletedNodeId, 39 byte[] deletedIdKey, 40 DatabaseId dbId) { 41 this.deletedNodeId = deletedNodeId; 42 this.deletedIdKey = deletedIdKey; 43 this.dbId = dbId; 44 } 45 46 49 public INDeleteInfo() { 50 dbId = new DatabaseId(); 51 } 52 53 56 public long getDeletedNodeId() { 57 return deletedNodeId; 58 } 59 60 public byte[] getDeletedIdKey() { 61 return deletedIdKey; 62 } 63 64 public DatabaseId getDatabaseId() { 65 return dbId; 66 } 67 68 71 public void optionalLog(LogManager logManager, 72 DatabaseImpl dbImpl) 73 throws DatabaseException { 74 75 if (!dbImpl.isDeferredWrite()) { 76 logManager.log(this); 77 } 78 } 79 80 83 public LogEntryType getLogType() { 84 return LogEntryType.LOG_IN_DELETE_INFO; 85 } 86 87 91 public boolean marshallOutsideWriteLatch() { 92 return true; 93 } 94 95 98 public boolean countAsObsoleteWhenLogged() { 99 return false; 100 } 101 102 105 public void postLogWork(long justLoggedLsn) { 106 } 107 108 111 public int getLogSize() { 112 return LogUtils.LONG_BYTES + 113 LogUtils.getByteArrayLogSize(deletedIdKey) + 114 dbId.getLogSize(); 115 } 116 117 120 public void writeToLog(ByteBuffer logBuffer) { 121 122 LogUtils.writeLong(logBuffer, deletedNodeId); 123 LogUtils.writeByteArray(logBuffer, deletedIdKey); 124 dbId.writeToLog(logBuffer); 125 } 126 127 130 public void readFromLog(ByteBuffer itemBuffer, byte entryTypeVersion) 131 throws LogException { 132 133 deletedNodeId = LogUtils.readLong(itemBuffer); 134 deletedIdKey = LogUtils.readByteArray(itemBuffer); 135 dbId.readFromLog(itemBuffer, entryTypeVersion); 136 } 137 138 141 public void dumpLog(StringBuffer sb, boolean verbose) { 142 sb.append("<INDeleteEntry node=\"").append(deletedNodeId); 143 sb.append("\">"); 144 sb.append(Key.dumpString(deletedIdKey, 0)); 145 dbId.dumpLog(sb, verbose); 146 sb.append("</INDeleteEntry>"); 147 } 148 149 152 public boolean logEntryIsTransactional() { 153 return false; 154 } 155 156 159 public long getTransactionId() { 160 return 0; 161 } 162 } 163 | Popular Tags |