def open.manifest.result
mylsm-lsm-store@0.6.0.1 · src/ByteDurableDb.bend:297
import mylsm-lsm-store@0.6.0.1/src/ByteDurableDb.bend as ByteDurableDb
import Base
import mylsm-lsm-store@0.6.0.1/src/ByteManifest.bend as ByteManifest
import mylsm-lsm-store@0.6.0.1/src/ByteManifestIo.bend as ByteManifestIo
import mylsm-lsm-store@0.6.0.1/src/ByteSstIo.bend as ByteSstIo
import mylsm-lsm-store@0.6.0.1/src/DbLock.bend as DbLock
import mylsm-lsm-store@0.6.0.1/src/scan/ByteBlockReader.bend as ByteBlockReader
import mylsm-lsm-store@0.6.0.1/src/scan/VisibleStats.bend as VisibleStats
297def open.manifest.result(
298 +path: String,
299 lock: DbLock.Lock,
300 result: Result<&1, &1, ByteManifestIo.Error, ByteManifest.ManifestValue>
301) -> IO(Result<&1, &1, Error, Handle>):
302 match result:
303 case Fail{error}: open.manifest.failed(path, lock, error)
304 case Done{ByteManifest.Empty{}}:
305 open.wal(path, lock, VisibleStats.Stats{0n, 0n})
306 case Done{ByteManifest.GenerationEmpty{}}:
307 open.wal(path, lock, VisibleStats.Stats{0n, 0n})
308 case Done{ByteManifest.HasSst{}}:
309 do IO<Result<&1, &1, Error, Handle>>:
310 metadata : Result<&1, &1, U32 & String, ByteBlockReader.Metadata> <-
311 ByteSstIo.validate(path ++ "/SST")
312 open.sst.validated(path, lock, metadata)
313 case Done{ByteManifest.GenerationSst{file_id}}:
314 do IO<Result<&1, &1, Error, Handle>>:
315 metadata : Result<&1, &1, U32 & String, ByteBlockReader.Metadata> <-
316 ByteSstIo.validate(ByteManifest.sst.generation.path(path, file_id))
317 open.sst.validated(path, lock, metadata)