def snapshot.root.value.length.dispatch
mylsm-lsm-store@0.6.0.1 · src/ByteDurableDb.bend:3065
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/coordinator/SnapshotValueLengthPolicy.bend as SnapshotValueLengthPolicy
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
3065def snapshot.root.value.length.dispatch(
3066 root: SnapshotRoot,
3067 +probe: ByteMemTable.LengthProbe,
3068 key: Bytes.Bytes,
3069 decision: SnapshotValueLengthPolicy.Decision
3070) -> IO(Result<&1, &1, Error, Maybe<&1, U32>>):
3071 match root:
3072 case SnapshotRoot{sst_path, _, _, _}:
3073 match decision:
3074 case SnapshotValueLengthPolicy.NeedSst{}:
3075 snapshot.root.value.length.metadata.read(sst_path, probe, key)
3076 case SnapshotValueLengthPolicy.Missing{}:
3077 IO.pure(Result<&1, &1, Error, Maybe<&1, U32>>, Done{None{}})
3078 case SnapshotValueLengthPolicy.Found{value_bytes}:
3079 IO.pure(Result<&1, &1, Error, Maybe<&1, U32>>,
3080 Done{Some{value_bytes}})