Skip to content

Defined in: packages/sorted-block/src/sorted-block.ts:29

An immutable sorted key-value block held in one Uint8Array.

Keys are distinct and ascend under compareBytes. Every read returns fresh copies of the bytes it reports, so a caller can mutate what it receives without changing the block, and the block owns a copy of every byte it was built from. A block never changes after construction, so its iterators never observe a modification.

readonly kind: "restart-point"

Defined in: packages/sorted-block/src/sorted-block.ts:30


readonly size: number

Defined in: packages/sorted-block/src/sorted-block.ts:32

Number of entries.


readonly byteLength: number

Defined in: packages/sorted-block/src/sorted-block.ts:34

Bytes of the encoded block payload: entries, restart table, and trailer.


readonly firstKey: Uint8Array<ArrayBufferLike> | undefined

Defined in: packages/sorted-block/src/sorted-block.ts:36

A copy of the smallest key, or undefined for an empty block.


readonly lastKey: Uint8Array<ArrayBufferLike> | undefined

Defined in: packages/sorted-block/src/sorted-block.ts:38

A copy of the largest key, or undefined for an empty block.


readonly get: (key) => Uint8Array<ArrayBufferLike> | undefined

Defined in: packages/sorted-block/src/sorted-block.ts:44

A copy of the value stored under key, or undefined when the block holds no such key.

Uint8Array

Uint8Array<ArrayBufferLike> | undefined

With INVALID_KEY when key is not a Uint8Array.


readonly has: (key) => boolean

Defined in: packages/sorted-block/src/sorted-block.ts:50

Whether the block holds key.

Uint8Array

boolean

With INVALID_KEY when key is not a Uint8Array.


readonly ceiling: (key) => SortedBlockEntry | undefined

Defined in: packages/sorted-block/src/sorted-block.ts:57

A copy of the smallest entry whose key is at or above key under compareBytes, or undefined when every key sorts below it.

Uint8Array

SortedBlockEntry | undefined

With INVALID_KEY when key is not a Uint8Array.


readonly entries: (…bounds) => IterableIterator<SortedBlockEntry>

Defined in: packages/sorted-block/src/sorted-block.ts:65

Walk entries in ascending key order: every entry, the open range [start, +∞), or the half-open range [start, end). Bounds are checked when the call is made, not on the first step.

[] | [start: Uint8Array<ArrayBufferLike>] | [start: Uint8Array<ArrayBufferLike>, end: Uint8Array<ArrayBufferLike>]

IterableIterator<SortedBlockEntry>

With INVALID_KEY when a bound is not a Uint8Array, or INVALID_RANGE when end sorts before start.


readonly [iterator]: () => IterableIterator<SortedBlockEntry>

Defined in: packages/sorted-block/src/sorted-block.ts:69

The same function as entries: a full walk in ascending key order.

IterableIterator<SortedBlockEntry>