public abstract class Record extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
TOMB_HEADER_SIZE
Size of the tombstone record header in a chunk file: seq, prefix, key size
|
static int |
VAL_HEADER_SIZE
Size of the value record header in a chunk file: seq, prefix, key size, value size
|
| Constructor and Description |
|---|
Record() |
| Modifier and Type | Method and Description |
|---|---|
abstract int |
additionalInt() |
long |
deadOrAliveSeq() |
long |
deadSeq()
Asserts that the record is dead and returns its sequence number.
|
abstract int |
decrementGarbageCount()
Decrements this record's garbage count.
|
int |
filePosition()
Asserts that this is a tombstone record and returns its offset in the underlying chunk file.
|
int |
garbageCount() |
abstract void |
incrementGarbageCount()
Increments this record's garbage count.
|
boolean |
isAlive() |
boolean |
isTombstone() |
abstract long |
keyPrefix(KeyHandle kh) |
long |
liveSeq()
Asserts that the record is alive and returns its sequence number.
|
abstract void |
negateSeq()
Negates the value of the
rawSeq property. |
int |
payloadSize() |
static long |
positionInUnitsOfBufsize(long filePosition)
Expresses the given file position in the unit of
HotRestarter.BUFFER_SIZE. |
abstract long |
rawSeqValue() |
abstract int |
rawSizeValue() |
void |
retire(boolean mayIncrementGarbageCount)
Retires this record (makes it dead).
|
abstract void |
setAdditionalInt(int value)
Sets the raw "additional int" property on this record.
|
void |
setFilePosition(int filePosition)
Asserts that this is a tombstone record and sets its offset in the underlying chunk file
to the supplied value.
|
void |
setGarbageCount(int newCount)
Sets this record's garbage count to the given value.
|
abstract void |
setRawSeqSize(long rawSeqValue,
int rawSizeValue)
Sets the raw "seq" and "size" values on this record.
|
int |
size() |
static int |
size(byte[] key,
byte[] value)
Calculates the size in bytes a record would have in a chunk file if it contained
the provided key and value blobs.
|
static int |
toRawSizeValue(int size,
boolean isTombstone)
Encodes the given
size and isTombstone parameters into a single int value
of the raw "size" property. |
String |
toString() |
void |
update(long seq,
int size)
Updates the sequence number and size properties of this record to the supplied values.
|
public static final int VAL_HEADER_SIZE
public static final int TOMB_HEADER_SIZE
public final long deadOrAliveSeq()
public final long liveSeq()
public final long deadSeq()
public final int size()
public final int payloadSize()
public final boolean isTombstone()
public boolean isAlive()
public final int garbageCount()
public final int filePosition()
public final void setFilePosition(int filePosition)
public final void update(long seq,
int size)
public final void retire(boolean mayIncrementGarbageCount)
mayIncrementGarbageCount - whether it is appropriate to increment the record's garbage count property
(it is not appropriate to increment if the record is being retired due to
a prefix tombstone)public abstract long keyPrefix(KeyHandle kh)
kh - the key handle associated with this recordpublic abstract void setRawSeqSize(long rawSeqValue,
int rawSizeValue)
rawSeqValue(),
rawSizeValue()public abstract long rawSeqValue()
garbageCount
keeps tracking the number of garbage records on the same key in the same chunk.public abstract int rawSizeValue()
public abstract void setAdditionalInt(int value)
additionalInt()public abstract int additionalInt()
public abstract void negateSeq()
rawSeq property.public abstract int decrementGarbageCount()
public abstract void incrementGarbageCount()
public final void setGarbageCount(int newCount)
public static int size(byte[] key,
byte[] value)
key - the key blobvalue - the value blob (a null value signals a tombstone record)public static int toRawSizeValue(int size,
boolean isTombstone)
size and isTombstone parameters into a single int value
of the raw "size" property.public static long positionInUnitsOfBufsize(long filePosition)
HotRestarter.BUFFER_SIZE. Used during writing to a chunk
file to determine when another buffer full of data was written out.Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.