def create.locked

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

import mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend as ByteDurableDb
import Base
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 mylsm-lsm-store@0.6.0.1/src/DurableError.bend as DurableError

192# Releases ownership when syncing the created database directory fails.
193def create.locked(
194  +path: String,
195  result: Result<&1, &1, DurableError.Error, DbLock.Lock>
196) -> IO(Result<&1, &1, Error, Handle>):
197  match result:
198    case Fail{error}:
199      IO.pure(Result<&1, &1, Error, Handle>, Fail{lock.error(error)})
200    case Done{lock}:
201      do IO<Result<&1, &1, Error, Handle>>:
202        created : Result<&1, &1, U32 & String, Unit> <- ByteWalIo.create(path ++ "/WAL")
203        initialized.manifest(path, lock, created)

Uses (16)

Used by (1)