src/Fs.bend relies on unsafe/foreign
raw source on the hub · import mylsm-lsm-store@0.5.0.0/src/Fs.bend as Fs
4 imports
import Base import bend-kit-bytes@0.3.2.0/bytes.bend as StorageBytes import 0x6c54b2522c2258baf6f58d2b970c3902/files.bend as PackedFiles import ./FsPolicy.bend as Policy
Definitions
def read_words source · line 10 · raw
@file:File -> @max:U32 -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>))
Read at most 1 MiB as packed words. Short reads are valid progress; zero is EOF.
def write_words source · line 18 · raw
@file:File -> @len:U32 -> @words:Array<U32> -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Unit>))
Write all bytes from a packed word array, retaining the file handle on errors.
def read_bytes.wrap source · line 26 · raw
@result:Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)> -> Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>
def read_bytes.pair source · line 36 · raw
@pair:Pair(File, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>)
def read_bytes source · line 45 · raw
@file:File -> @max:U32 -> IO(Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>))
Read one bounded packed chunk; nonempty short reads are not EOF.
def write_bytes source · line 55 · raw
@file:File -> @bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Unit>))
Write the significant bytes of a packed buffer through the pinned host effect.
def rename source · line 74 · raw
@old:String -> @new:String -> IO(Result<&1, &1, Pair(U32, String), Unit>)
Atomically rename a filesystem path.
def remove source · line 78 · raw
@path:String -> IO(Result<&1, &1, Pair(U32, String), Unit>)
Remove a file or empty directory.
def exists.result source · line 102 · raw
@result:Result<&1, &1, Pair(U32, String), 0x6c54b2522c2258baf6f58d2b970c3902/files.Info> -> Result<&1, &1, Pair(U32, String), Bool>
Check whether a filesystem path exists.
def exists source · line 110 · raw
@path:String -> IO(Result<&1, &1, Pair(U32, String), Bool>)
Returns whether a path exists and preserves other stat errors.
def grab_name source · line 122 · raw
@nm:String -> @acc:List<&1, String> -> List<&1, String>
Pure accumulator step (leaf: matches structurally, never recurses). Past-end fetches answer "" (SNil{}), which is skipped.
def read_go source · line 131 · raw
@fuel:Nat -> @+path:String -> @+idx:Nat -> @acc:List<&1, String> -> IO(List<&1, String>)
Fuel-bounded sweep 0..count-1. Startup-only use (spec §10 below): the directory is stable during recovery, so count-then-fetch is exact.
def read_dir source · line 141 · raw
@+path:String -> IO(Result<&1, &1, Pair(U32, String), List<&1, String>>)
List directory names using the bounded count-then-fetch host API.
Effects (foreign code)
effect fsync source · line 64 · raw
@path:String -> IO(Result<&1, &1, Pair(U32, String), Unit>)
Sync file contents to stable storage.
foreign: src/effs/fsync.c, src/effs/fsync.js
effect truncate source · line 69 · raw
@path:String -> @offset:Nat -> IO(Result<&1, &1, Pair(U32, String), Unit>)
Handle truncate in the filesystem effects.
foreign: src/effs/truncate.c, src/effs/truncate.js
effect read_dir_count source · line 82 · raw
@path:String -> IO(Result<&1, &1, Pair(U32, String), Nat>)
Return the number of entries available through the indexed directory API.
foreign: src/effs/read_dir.c, src/effs/read_dir.js
effect read_dir_at source · line 87 · raw
@path:String -> @idx:Nat -> IO(Result<&1, &1, Pair(U32, String), String>)
Fetch one directory entry by index.
foreign: src/effs/read_dir.c, src/effs/read_dir.js
effect make_dir source · line 92 · raw
@path:String -> IO(Result<&1, &1, Pair(U32, String), Unit>)
Create one directory.
foreign: src/effs/make_dir.c, src/effs/make_dir.js
effect chmod source · line 97 · raw
@path:String -> @bits:U32 -> IO(Result<&1, &1, Pair(U32, String), Unit>)
Set POSIX permission bits.
foreign: src/effs/chmod.c, src/effs/chmod.js
effect file_size source · line 116 · raw
@path:String -> IO(Result<&1, &1, Pair(U32, String), Nat>)
Read-only byte size for Bend-side accounting (no shell wc needed).
foreign: src/effs/file_size.c, src/effs/file_size.js