def read.size

mylsm-lsm-store@0.6.0.1 · src/coordinator/OwnerGenerationIo.bend:80

import mylsm-lsm-store@0.6.0.1/src/coordinator/OwnerGenerationIo.bend as OwnerGenerationIo
import Base
import mylsm-lsm-store@0.6.0.1/src/Fs.bend as Fs
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

80def read.size(
81  file: File,
82  result: Result<&1, &1, U32 & String, Nat>
83) -> IO(Result<&1, &1, Error, U32>):
84  match result:
85    case Fail{error}:
86      do IO<Result<&1, &1, Error, U32>>:
87        _closed : Unit <- File.close(file)
88        return Fail{host(error)}
89    case Done{4n}:
90      do IO<Result<&1, &1, Error, U32>>:
91        pair : File & Result<&1, &1, U32 & String, Bytes.Bytes> <-
92          Fs.read_at(file, 0, 4)
93        read.pair(pair)
94    case Done{_}:
95      do IO<Result<&1, &1, Error, U32>>:
96        _closed : Unit <- File.close(file)
97        return Fail{Invalid{}}

Uses (16)

Used by (1)