Skip to content

deserializeSortedBlock(bytes): SortedBlock

Defined in: packages/sorted-block/src/serialization.ts:95

Decode bytes written by serializeSortedBlock.

The payload is validated in full before a block is returned, in O(byte length): the trailer and restart-table geometry, restart offsets that start at 0, strictly ascend, and land on entry boundaries, canonical uint32 varints, entries inside the entries section, a zero shared prefix at every restart point and none longer than the previous key, strictly ascending rebuilt keys, and an entry count equal to the trailer’s. The block owns a copy of the bytes.

Uint8Array

SortedBlock

With CORRUPT_BLOCK_PAYLOAD when the payload breaks one of those rules, INVALID_PACKAGE_HEADER for a malformed header, UNKNOWN_KIND for a kind tag this release does not read, or a shared wire code from SORTED_BLOCK_PARSE_ERROR_CODES for a malformed envelope.