def wal.opened

mylsm-lsm-store@0.6.0.1 · src/transfer/MigrateIo.bend:575

import mylsm-lsm-store@0.6.0.1/src/transfer/MigrateIo.bend as MigrateIo
import Base
import mylsm-lsm-store@0.6.0.1/src/DbLock.bend as DbLock
import mylsm-lsm-store@0.6.0.1/src/Fs.bend as Fs
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

575# Reads a bounded WAL file while retaining the exclusive source lock.
576def wal.opened(
577  lock: DbLock.Lock,
578  size: Nat,
579  opened: Result<&1, &1, U32 & String, File>,
580  path: String
581) -> IO(Result<&1, &1, Error, Nat>):
582  match opened:
583    case Fail{error}: host.failed(lock, error, path)
584    case Done{file}:
585      do IO<Result<&1, &1, Error, Nat>>:
586        read : File & Result<&1, &1, U32 & String, Bytes.Bytes> <-
587          Fs.read_at(file, 0, U32.from_nat(size))
588        wal.read.pair(read, lock, path)

Uses (15)

Used by (1)