def snapshot.root.manifest.result

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

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/ByteManifest.bend as ByteManifest
import mylsm-lsm-store@0.6.0.1/src/ByteManifestIo.bend as ByteManifestIo

2585def snapshot.root.manifest.result(
2586  read_path: String,
2587  handle: Handle,
2588  delta: List<&1, ByteMemTable.Entry>,
2589  delta_bytes: Nat,
2590  max_bytes: Nat,
2591  result: Result<&1, &1, ByteManifestIo.Error, ByteManifest.ManifestValue>
2592) -> IO(Handle & Result<&1, &1, Error, SnapshotRoot>):
2593  match result:
2594    case Fail{ByteManifestIo.Invalid{_}}:
2595      IO.pure(Handle & Result<&1, &1, Error, SnapshotRoot>,
2596        (handle, Fail{Corruption{"byte manifest validation failed"}}))
2597    case Fail{ByteManifestIo.Host{code, message}}:
2598      IO.pure(Handle & Result<&1, &1, Error, SnapshotRoot>,
2599        (handle, Fail{Io{code, message}}))
2600    case Done{ByteManifest.Empty{}}:
2601      snapshot.root.reservation(handle, None{}, None{}, 0n, delta_bytes, delta,
2602        max_bytes)
2603    case Done{ByteManifest.GenerationEmpty{}}:
2604      snapshot.root.reservation(handle, None{}, None{}, 0n, delta_bytes, delta,
2605        max_bytes)
2606    case Done{ByteManifest.HasSst{}}:
2607      snapshot.root.file.size(handle,
2608        path.clone.pair(read_path ++ "/SST"), None{}, delta, delta_bytes,
2609        max_bytes)
2610    case Done{ByteManifest.GenerationSst{file_id}}:
2611      snapshot.root.generation.file(handle, read_path, delta, delta_bytes,
2612        max_bytes, ByteManifest.clone.file.id(file_id))

Uses (21)

Used by (1)