def record.convert

mylsm-lsm-store@0.6.0.1 · src/Wal.bend:39

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

39def record.convert(
40  pair: Bytes.Cursor & Result<&1, &1, SstFile.Error, SstFile.ParsedRecord>
41) -> Bytes.Cursor & Result<&1, &1, Error, Mut>:
42  match pair:
43    case (cursor, Fail{error}):
44      (cursor, Fail{record.error(error)})
45    case (cursor, Done{SstFile.Rec{MemTable.Entry{key, None{}}, _}}):
46      (cursor, Done{Del{key}})
47    case (cursor, Done{SstFile.Rec{MemTable.Entry{key, Some{value}}, _}}):
48      (cursor, Done{Put{key, value}})

Uses (11)

Used by (1)