def flush.snapshot.manifest

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

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
import mylsm-lsm-store@0.6.0.1/src/DbLock.bend as DbLock
import mylsm-lsm-store@0.6.0.1/src/scan/VisibleStats.bend as VisibleStats

842def flush.snapshot.manifest(
843  path: String,
844  lock: DbLock.Lock,
845  table: ByteMemTable.Table,
846  entries: List<&1, ByteMemTable.Entry> & List<&1, ByteMemTable.Entry>,
847  result: Result<&1, &1, ByteManifestIo.Error, ByteManifest.ManifestValue>
848) -> IO(Handle & Result<&1, &1, Error, Unit>):
849  match result:
850    case Fail{ByteManifestIo.Invalid{_}}:
851      IO.pure(Handle & Result<&1, &1, Error, Unit>,
852        (Handle{path, lock, table, Open{}, VisibleStats.Stats{0n, 0n}},
853          Fail{Corruption{"byte manifest validation failed"}}))
854    case Fail{ByteManifestIo.Host{code, message}}:
855      IO.pure(Handle & Result<&1, &1, Error, Unit>,
856        (Handle{path, lock, table, Open{}, VisibleStats.Stats{0n, 0n}},
857          Fail{Io{code, message}}))
858    case Done{value}:
859      flush.snapshot.identifier(path.clone.triple(path), lock, table, entries,
860        ByteManifest.next.file.id(value))

Uses (20)

Used by (1)