def decode.frame

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

import mylsm-lsm-store@0.6.0.1/src/ByteSstFile.bend as ByteSstFile
import Base
import mylsm-lsm-store@0.6.0.1/src/ByteMemTable.bend as ByteMemTable
import mylsm-lsm-store@0.6.0.1/src/ByteWal.bend as ByteWal
import mylsm-lsm-store@0.6.0.1/src/Wal.bend as Wal

886# Decodes the inner checksummed frame and applies exactly its declared count.
887def decode.frame(
888  total: U32,
889  result: Result<&1, &1, Wal.Error, ByteWal.Batch>
890) -> Result<&1, &1, Error, ByteMemTable.Table>:
891  match result:
892    case Fail{Wal.ChecksumMismatch{}}:
893      Fail{ChecksumMismatch{}}
894    case Fail{_}:
895      Fail{Malformed{}}
896    case Done{ByteWal.Batch{mutations}}:
897      decode.apply(U32.to_nat(total), ByteMemTable.empty(), mutations)

Uses (9)

Used by (1)