def measure.block.count

mylsm-lsm-store@0.6.0.1 · src/ByteSstFile.bend:1421

import mylsm-lsm-store@0.6.0.1/src/ByteSstFile.bend as ByteSstFile
import Base
import mylsm-lsm-store@0.6.0.1/src/ByteWal.bend as ByteWal
import mylsm-lsm-store@0.6.0.1/src/StorageBytes.bend as StorageBytes
import mylsm-lsm-store@0.6.0.1/src/Wal.bend as Wal
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

1421def measure.block.count(
1422  pair: Bytes.Bytes & Maybe<&2, U32>,
1423  +payload_length: U32,
1424  +total: U32,
1425  query: Bytes.Bytes
1426) -> Result<&1, &1, Wal.Error, ByteWal.ValueMetadata>:
1427  match pair:
1428    case (frame, Some{record_count}):
1429      measure.block.valid(frame, query, record_count, payload_length, total,
1430        U32.is_le(payload_length, StorageBytes.MAX_BLOCK_BYTES()) &&
1431          U32.is_eq(total, U32.add(40, payload_length)))
1432    case (_, None{}): Fail{Wal.Malformed{}}

Uses (14)

Used by (1)