def stream.block

mylsm-lsm-store@0.6.0.1 · src/SstFile.bend:1516

import mylsm-lsm-store@0.6.0.1/src/SstFile.bend as SstFile
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

1516def stream.block(state: StreamState, bytes: Bytes.Bytes) -> Result<&1, &1, Error, StreamState>:
1517  match state:
1518    case StreamState{_, _, _, 0, _, _, _, _}:
1519      Fail{Malformed{}}
1520    case StreamState{+level, +total, +block_count, +remaining,
1521        +entries_left, +previous, entries, hashes}:
1522      stream.block.result(
1523        StreamState{level, total, block_count, remaining, entries_left,
1524          previous, entries, hashes},
1525        parse.block(Bytes.Cursor.new(bytes), previous))

Uses (11)

Used by (1)