1 8 9 package com.sleepycat.je.tree; 10 11 import java.nio.ByteBuffer ; 12 13 import com.sleepycat.je.log.LogException; 14 import com.sleepycat.je.log.LogReadable; 15 import com.sleepycat.je.log.LogUtils; 16 import com.sleepycat.je.log.LogWritable; 17 import com.sleepycat.je.utilint.DbLsn; 18 19 23 public class DeltaInfo implements LogWritable, LogReadable { 24 private byte[] key; 25 private long lsn; 26 private byte state; 27 28 DeltaInfo(byte[] key, long lsn, byte state) { 29 this.key = key; 30 this.lsn = lsn; 31 this.state = state; 32 } 33 34 37 DeltaInfo() { 38 lsn = DbLsn.NULL_LSN; 39 } 40 41 44 public int getLogSize() { 45 return 46 LogUtils.getByteArrayLogSize(key) + 47 LogUtils.getLongLogSize() + 1; } 50 51 54 public void writeToLog(ByteBuffer logBuffer) { 55 LogUtils.writeByteArray(logBuffer, key); 56 LogUtils.writeLong(logBuffer, lsn); 57 logBuffer.put(state); 58 } 59 60 64 public void readFromLog(ByteBuffer itemBuffer, byte entryTypeVersion) 65 throws LogException { 66 67 key = LogUtils.readByteArray(itemBuffer); 68 lsn = LogUtils.readLong(itemBuffer); 69 state = itemBuffer.get(); 70 } 71 72 75 public void dumpLog(StringBuffer sb, boolean verbose) { 76 sb.append(Key.dumpString(key, 0)); 77 sb.append(DbLsn.toString(lsn)); 78 IN.dumpDeletedState(sb, state); 79 } 80 81 84 public boolean logEntryIsTransactional() { 85 return false; 86 } 87 88 91 public long getTransactionId() { 92 return 0; 93 } 94 95 98 byte[] getKey() { 99 return key; 100 } 101 102 105 byte getState() { 106 return state; 107 } 108 109 112 boolean isKnownDeleted() { 113 return IN.isStateKnownDeleted(state); 114 } 115 116 119 long getLsn() { 120 return lsn; 121 } 122 } 123 | Popular Tags |