Interface LeafBlock

All Superinterfaces:
Block
All Known Implementing Classes:
LeafBlockV1

public interface LeafBlock
extends Block
  • 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
    • findRecordId

      default Optional<Long> findRecordId​(byte[] searchKey)
    • findRecordIndex

      default Optional<Integer> findRecordIndex​(byte[] searchKey)
    • search

      default SnapshotLeafSearchResult search​(byte[] searchKey)
    • 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()
    • snapshotLeafRecord

      default SnapshotLeafRecord snapshotLeafRecord​(long recordId)
    • leafRecords

      default io.datarouter.scanner.Scanner<SnapshotLeafRecord> leafRecords()
    • getValueBlock

      default LeafBlock.ValueLocation getValueBlock​(int column, long recordId)
    • findValueBlock

      default Optional<LeafBlock.ValueLocation> findValueBlock​(int column, byte[] searchKey)
    • 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)
    • valueBlockKey

      BlockKey valueBlockKey​(SnapshotKey snapshotKey, 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)