def append.synced

mylsm-lsm-store@0.6.0.1 · src/ByteDurableDb.bend:516

import mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend as ByteDurableDb
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/DbLock.bend as DbLock
import mylsm-lsm-store@0.6.0.1/src/CrashPoint.bend as CrashPoint
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

516# Converts decoded frame validation into a committed handle state.
517def append.synced(
518  +path: String,
519  lock: DbLock.Lock,
520  table: ByteMemTable.Table,
521  apply_frame: Bytes.Bytes,
522  result: Result<&1, &1, U32 & String, Unit>
523) -> IO(Handle & Result<&1, &1, Error, Unit>):
524  match result:
525    case Fail{error}:
526      IO.pure(Handle & Result<&1, &1, Error, Unit>,
527        append.unknown(path, lock, table, error))
528    case Done{Unit{}}:
529      do IO<Handle & Result<&1, &1, Error, Unit>>:
530        _checkpoint : Result<&1, &1, U32 & String, Unit> <-
531          CrashPoint.hit("wal.after_sync_before_apply")
532        return append.applied(path, lock, table, ByteWal.decode(apply_frame))

Uses (17)

Used by (1)