def append.frames

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

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

534# Replaces the in-memory table only after the WAL frame is durable.
535def append.frames(
536  +path: String,
537  lock: DbLock.Lock,
538  table: ByteMemTable.Table,
539  frames: Bytes.Bytes & Bytes.Bytes
540) -> IO(Handle & Result<&1, &1, Error, Unit>):
541  match frames:
542    case (append_frame, apply_frame):
543      do IO<Handle & Result<&1, &1, Error, Unit>>:
544        appended : Result<&1, &1, U32 & String, Unit> <-
545          ByteWalIo.append.encoded(Done{append_frame}, path ++ "/WAL")
546        append.synced(path, lock, table, apply_frame, appended)

Uses (16)

Used by (1)