1 8 9 package com.sleepycat.je.log.entry; 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.log.LogEntryType; 16 import com.sleepycat.je.log.LogUtils; 17 import com.sleepycat.je.tree.Key; 18 import com.sleepycat.je.tree.LN; 19 import com.sleepycat.je.txn.Txn; 20 21 27 public class DeletedDupLNLogEntry extends LNLogEntry { 28 29 34 private byte[] dataAsKey; 35 36 39 public DeletedDupLNLogEntry(boolean isTransactional) { 40 super(com.sleepycat.je.tree.LN.class, isTransactional); 41 } 42 43 46 public DeletedDupLNLogEntry(LogEntryType entryType, 47 LN ln, 48 DatabaseId dbId, 49 byte[] key, 50 byte[] dataAsKey, 51 long abortLsn, 52 boolean abortKnownDeleted, 53 Txn txn) { 54 super(entryType, ln, dbId, key, abortLsn, abortKnownDeleted, txn); 55 this.dataAsKey = dataAsKey; 56 } 57 58 62 public void readEntry(ByteBuffer entryBuffer, 63 int entrySize, 64 byte entryTypeVersion, 65 boolean readFullItem) 66 throws DatabaseException { 67 68 super.readEntry(entryBuffer, entrySize, 69 entryTypeVersion, readFullItem); 70 71 72 if (readFullItem) { 73 dataAsKey = LogUtils.readByteArray(entryBuffer); 74 } else { 75 76 dataAsKey = null; 77 } 78 } 79 80 84 public StringBuffer dumpEntry(StringBuffer sb, boolean verbose) { 85 super.dumpEntry(sb, verbose); 86 sb.append(Key.dumpString(dataAsKey, 0)); 87 return sb; 88 } 89 90 93 94 98 public int getLogSize() { 99 return super.getLogSize() + 100 LogUtils.getByteArrayLogSize(dataAsKey); 101 } 102 103 106 public void writeToLog(ByteBuffer destBuffer) { 107 super.writeToLog(destBuffer); 108 LogUtils.writeByteArray(destBuffer, dataAsKey); 109 } 110 111 114 115 118 public byte[] getDupKey() { 119 return dataAsKey; 120 } 121 } 122 | Popular Tags |