def snapshot.manifest.result.paths

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

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/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/VisibleStats.bend as VisibleStats

2404def snapshot.manifest.result.paths(
2405  paths: String & String,
2406  lock: DbLock.Lock,
2407  table: ByteMemTable.Table,
2408  state: HandleState,
2409  base_stats: VisibleStats.Stats,
2410  result: Result<&1, &1, ByteManifestIo.Error, ByteManifest.ManifestValue>
2411) -> IO(Handle & Result<&1, &1, Error, List<&1, ByteMemTable.Entry>>):
2412  match paths:
2413    case (read_path, retained_path):
2414      match result:
2415        case Fail{ByteManifestIo.Invalid{_}}:
2416          IO.pure(Handle & Result<&1, &1, Error, List<&1, ByteMemTable.Entry>>,
2417            (Handle{retained_path, lock, table, state, base_stats},
2418              Fail{Corruption{"byte manifest validation failed"}}))
2419        case Fail{ByteManifestIo.Host{code, message}}:
2420          IO.pure(Handle & Result<&1, &1, Error, List<&1, ByteMemTable.Entry>>,
2421            (Handle{retained_path, lock, table, state, base_stats}, Fail{Io{code, message}}))
2422        case Done{ByteManifest.Empty{}}:
2423          snapshot.limited.saved.result(
2424            Handle{retained_path, lock, table, state, base_stats}, Done{ByteMemTable.empty()})
2425        case Done{ByteManifest.GenerationEmpty{}}:
2426          snapshot.limited.saved.result(
2427            Handle{retained_path, lock, table, state, base_stats}, Done{ByteMemTable.empty()})
2428        case Done{ByteManifest.HasSst{}}:
2429          do IO<Handle & Result<&1, &1, Error, List<&1, ByteMemTable.Entry>>>:
2430            base : Result<&1, &1, U32 & String, ByteMemTable.Table> <-
2431              ByteSstIo.read(read_path ++ "/SST")
2432            snapshot.limited.saved.result(
2433              Handle{retained_path, lock, table, state, base_stats}, base)
2434        case Done{ByteManifest.GenerationSst{file_id}}:
2435          do IO<Handle & Result<&1, &1, Error, List<&1, ByteMemTable.Entry>>>:
2436            base : Result<&1, &1, U32 & String, ByteMemTable.Table> <-
2437              ByteSstIo.read(ByteManifest.sst.generation.path(read_path, file_id))
2438            snapshot.limited.saved.result(
2439              Handle{retained_path, lock, table, state, base_stats}, base)

Uses (23)

Used by (1)