Class LeafBlockV1Encoder
java.lang.Object
io.datarouter.filesystem.snapshot.block.leaf.LeafBlockV1Encoder
- All Implemented Interfaces:
BlockEncoder,DataBlockEncoder,LeafBlockEncoder
public class LeafBlockV1Encoder extends Object implements LeafBlockEncoder
-
Field Summary
Fields inherited from interface io.datarouter.filesystem.snapshot.encode.LeafBlockEncoder
BLOCK_ID_COMPARATOR -
Constructor Summary
Constructors Constructor Description LeafBlockV1Encoder(int leafEncoderChunkSize) -
Method Summary
Modifier and Type Method Description voidadd(int blockId, long recordId, SnapshotEntry entry, int[] valueBlockIds, int[] valueIndexes)voidassertKeysSorted()intblockId()EncodedBlockencode(BlockQueue.FileIdsAndEndings[] fileIdsAndEndings)byte[]firstKey()intfirstValueBlockId(int column)Stringformat()intnumBytes()Used to determine when to flush a block.intnumRecords()The number of items in the block.intnumValueBlocks(int column)
-
Constructor Details
-
LeafBlockV1Encoder
public LeafBlockV1Encoder(int leafEncoderChunkSize)
-
-
Method Details
-
format
- Specified by:
formatin interfaceBlockEncoder
-
add
public void add(int blockId, long recordId, SnapshotEntry entry, int[] valueBlockIds, int[] valueIndexes)- Specified by:
addin interfaceLeafBlockEncoder
-
numRecords
public int numRecords()Description copied from interface:DataBlockEncoderThe number of items in the block. Zero indicates we don't need to flush it.- Specified by:
numRecordsin interfaceDataBlockEncoder
-
numBytes
public int numBytes()Description copied from interface:DataBlockEncoderUsed to determine when to flush a block. We won't always know the exact block size until we actually encode it.- Specified by:
numBytesin interfaceDataBlockEncoder
-
firstKey
public byte[] firstKey()- Specified by:
firstKeyin interfaceLeafBlockEncoder
-
assertKeysSorted
public void assertKeysSorted()- Specified by:
assertKeysSortedin interfaceLeafBlockEncoder
-
blockId
public int blockId()- Specified by:
blockIdin interfaceLeafBlockEncoder
-
firstValueBlockId
public int firstValueBlockId(int column)- Specified by:
firstValueBlockIdin interfaceLeafBlockEncoder
-
numValueBlocks
public int numValueBlocks(int column)- Specified by:
numValueBlocksin interfaceLeafBlockEncoder
-
encode
- Specified by:
encodein interfaceLeafBlockEncoder
-