- All Superinterfaces:
Block
- All Known Implementing Classes:
LeafBlockV1
public interface LeafBlock
extends Block
-
-
Method Summary
| Modifier and Type |
Method |
Description |
io.datarouter.bytes.Bytes |
blockKey(int index) |
|
io.datarouter.bytes.Bytes |
blockValue(int index) |
|
default Optional<Long> |
findRecordId(byte[] searchKey) |
|
default Optional<Integer> |
findRecordIndex(byte[] searchKey) |
|
default Optional<LeafBlock.ValueLocation> |
findValueBlock(int column,
byte[] searchKey) |
|
default long |
firstRecordId() |
|
int |
firstValueBlockId(int column) |
|
int |
firstValueIndex(int column) |
|
default LeafBlock.ValueLocation |
getValueBlock(int column,
long recordId) |
|
default int |
insertionIndex(byte[] searchKey) |
|
default io.datarouter.scanner.Scanner<byte[]> |
keyCopies() |
|
default io.datarouter.scanner.Scanner<io.datarouter.bytes.Bytes> |
keys() |
The Scanner may reuse the same ByteRange for all keys, meaning the caller should clone the ByteRanges if they
need to be long-lived.
|
default io.datarouter.scanner.Scanner<SnapshotLeafRecord> |
leafRecords() |
|
int |
numRecords() |
|
int |
numValueBlocks(int column) |
|
long |
recordId(int index) |
|
default SnapshotLeafSearchResult |
search(byte[] searchKey) |
|
default io.datarouter.bytes.Bytes |
snapshotKey(long recordId) |
|
default SnapshotLeafRecord |
snapshotLeafRecord(long recordId) |
|
default io.datarouter.bytes.Bytes |
snapshotValue(long recordId) |
|
int |
valueBlockEnding(int column,
int valueBlockId) |
|
default io.datarouter.scanner.Scanner<Integer> |
valueBlockIds(int column) |
|
BlockKey |
valueBlockKey(SnapshotKey snapshotKey,
int column,
int valueBlockId) |
|
int |
valueBlockOffset(int column,
int valueBlockOffsetIndex) |
|
default int |
valueBlockOffsetForKey(int column,
int index) |
|
default io.datarouter.scanner.Scanner<byte[]> |
valueCopies() |
|
default int |
valueIndex(int column,
int valueBlockOffsetForKey,
int index) |
|
default io.datarouter.scanner.Scanner<io.datarouter.bytes.Bytes> |
values() |
|
Methods inherited from interface io.datarouter.filesystem.snapshot.block.Block
heapSize
-
Method Details
-
recordId
long recordId(int index)
-
firstRecordId
default long firstRecordId()
- Returns:
- Offset from first key in snapshot
-
numRecords
int numRecords()
- Returns:
- Number of keys in the block
-
-
-
-
insertionIndex
default int insertionIndex(byte[] searchKey)
- Returns:
- index of first match if present, otherwise -(insertionPoint + 1)
-
blockKey
io.datarouter.bytes.Bytes blockKey(int index)
- Returns:
- Nth key in the block
-
snapshotKey
default io.datarouter.bytes.Bytes snapshotKey(long recordId)
- Returns:
- Nth key in the snapshot
-
keys
default io.datarouter.scanner.Scanner<io.datarouter.bytes.Bytes> keys()
The Scanner may reuse the same ByteRange for all keys, meaning the caller should clone the ByteRanges if they
need to be long-lived.
- Returns:
- Scanner of key transient ByteRanges
-
keyCopies
default io.datarouter.scanner.Scanner<byte[]> keyCopies()
-
blockValue
io.datarouter.bytes.Bytes blockValue(int index)
- Returns:
- Nth value in the block
-
snapshotValue
default io.datarouter.bytes.Bytes snapshotValue(long recordId)
- Returns:
- Nth key in the snapshot
-
values
default io.datarouter.scanner.Scanner<io.datarouter.bytes.Bytes> values()
-
valueCopies
default io.datarouter.scanner.Scanner<byte[]> valueCopies()
-
-
-
-
-
firstValueBlockId
int firstValueBlockId(int column)
- Returns:
- First ValueBlock known to this LeafBlock
-
numValueBlocks
int numValueBlocks(int column)
- Returns:
- Number of ValueBlocks referenced by this LeafBlock
-
valueBlockIds
default io.datarouter.scanner.Scanner<Integer> valueBlockIds(
int column)
-
valueBlockEnding
int valueBlockEnding(int column,
int valueBlockId)
-
-
firstValueIndex
int firstValueIndex(int column)
- Returns:
- First index into first ValueBlock known to this LeafBlock
-
valueBlockOffset
int valueBlockOffset(int column,
int valueBlockOffsetIndex)
- Parameters:
valueBlockOffsetIndex - offset into the list of valueBlockOffsets. Passing 0 should always return 0.
- Returns:
- recordIndex at the requested offset
-
valueBlockOffsetForKey
default int valueBlockOffsetForKey(int column,
int index)
- Parameters:
index - Record index
- Returns:
- Offset of ValueBlock from firstValueBlock
-
valueIndex
default int valueIndex(int column,
int valueBlockOffsetForKey,
int index)
- Parameters:
index - Key index
- Returns:
- The index of the value in the value block (not the byte offset)