def read_at.start.validated

mylsm-lsm-store@0.6.0.1 · src/Fs.bend:323

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

323def read_at.start.validated(
324  file: File,
325  offset: Nat,
326  maxima: Nat & Nat,
327  valid: Bool
328) -> IO(File & Result<&1, &1, U32 & String, StorageBytes.Bytes>):
329  match maxima:
330    case (for_fuel, for_remaining):
331      match valid:
332        case False{}:
333          IO.pure(File & Result<&1, &1, U32 & String, StorageBytes.Bytes>,
334            (file, Fail{(22, "positional read range exceeds offset limits")}))
335        case True{}:
336          read_at.loop(Nat.add(Nat.mul(3n, for_fuel), 3n),
337            ReadAtNeed{file, offset, for_remaining, Nil{}})

Uses (16)

Used by (1)