~/bend-docscommunity

src/ByteSstIo.bend relies on unsafe/foreign

raw source on the hub · import mylsm-lsm-store@0.6.0.2/src/ByteSstIo.bend as ByteSstIo

6 imports
import Base
import ./ByteSstFile.bend as ByteSstFile
import ./ByteMemTable.bend as ByteMemTable
import ./Fs.bend as Fs
import ./scan/ByteBlockReader.bend as ByteBlockReader
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

Types

type ReadState source · line 55 · raw

Type

Carries the reader or its latest step through blockwise recovery.

type ValidationState source · line 61 · raw

Type

Carries only bounded reader state and compact file metadata during validation.

Definitions

def path.clone.reverse source · line 8 · raw

@path:String -> @reversed:String -> String

def path.clone source · line 14 · raw

@path:String -> String

def nat.clone.pair.step source · line 17 · raw

@pair:Pair(Nat, Nat) -> Pair(Nat, Nat)

def nat.clone.pair source · line 21 · raw

@value:Nat -> Pair(Nat, Nat)

def path.clone.pair.scalar source · line 26 · raw

@first:String -> @second:String -> @scalars:Pair(Nat, Nat) -> Pair(String, String)

def path.clone.pair.build source · line 36 · raw

@path:String -> @copies:Pair(String, String) -> Pair(String, String)

def path.clone.pair source · line 51 · raw

@path:String -> Pair(String, String)

def corruption source · line 70 · raw

@message:String -> Pair(U32, String)

Classifies malformed or oversized byte SST files as corruption.

def validate.page source · line 73 · raw

@entries:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> @metadata:0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Metadata -> 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Metadata

def validate.loop source · line 92 · raw

@fuel:Nat -> @state:ValidationState -> IO(Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Metadata>)

Advances full-file validation without retaining decoded SST entries.

def validate.budget source · line 140 · raw

@metadata:0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Metadata -> @pair:Pair(Nat, 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Reader) -> IO(Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Metadata>)

Starts metadata-only validation with the reader's bounded transition budget.

def validate.metadata source · line 149 · raw

@pair:Pair(0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Metadata, 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Reader) -> IO(Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Metadata>)

Preserves metadata while deriving the reader budget from its parsed header.

def validate.opened source · line 157 · raw

@opened:Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Reader> -> IO(Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Metadata>)

Extracts metadata before consuming the reader through the validation pass.

def validate source · line 167 · raw

@+path:String -> IO(Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Metadata>)

Validates an SST incrementally and returns only authenticated metadata.

def read.fold source · line 173 · raw

@entries:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> @table:0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table -> 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table

def read.loop source · line 184 · raw

@fuel:Nat -> @state:ReadState -> IO(Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table>)

def read.loop.start source · line 216 · raw

@pair:Pair(Nat, 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Reader) -> IO(Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table>)

def read.opened source · line 221 · raw

@opened:Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/scan/ByteBlockReader.Reader> -> IO(Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table>)

def write.directory.synced source · line 231 · raw

@+directory:String -> @result:Result<&1, &1, Pair(U32, String), Unit> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

Syncs the parent directory after SST rename publication.

def write.published source · line 242 · raw

@+directory:String -> @temporary:String -> @final_path:String -> @result:Result<&1, &1, Pair(U32, String), Unit> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

Atomically renames the synced temporary SST and syncs its directory.

def write.synced source · line 258 · raw

@+directory:String -> @temporaries:Pair(String, String) -> @final_path:String -> @result:Result<&1, &1, Pair(U32, String), Unit> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

Syncs the temporary SST contents before publication.

def write.written source · line 275 · raw

@+directory:String -> @temporary:String -> @final_path:String -> @pair:Pair(File, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Result<&1, &1, Pair(U32, String), Unit>)

Closes the completed temporary-file write before syncing it.

def write.encoded source · line 288 · raw

@+directory:String -> @temporary:String -> @final_path:String -> @bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @opened:Result<&1, &1, Pair(U32, String), File> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

Writes the encoded SST bytes to the temporary file.

def write.encoder.failed source · line 304 · raw

@opened:Result<&1, &1, Pair(U32, String), File> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

Closes the temporary file when encoding rejects sorted input.

def write.opened source · line 316 · raw

@+directory:String -> @temporary:String -> @final_path:String -> @encoded:Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteSstFile.Error, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> @opened:Result<&1, &1, Pair(U32, String), File> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

Dispatches a validated encoding result after opening the temporary file.

def path.temporary.final source · line 329 · raw

@copies:Pair(String, String) -> Pair(String, String)

def write_atomic_at.opened source · line 334 · raw

@+directory:String -> @temporary_copies:Pair(String, String) -> @final_path:String -> @entries:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

def write_atomic_at.paths source · line 347 · raw

@+directory:String -> @paths:Pair(String, String) -> @entries:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

def write_atomic_at source · line 358 · raw

@+directory:String -> @final_path:String -> @entries:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

Atomically publishes one bounded byte SST at a caller-selected path.

def write_atomic source · line 367 · raw

@+directory:String -> @entries:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

Encodes and atomically publishes one bounded byte SST snapshot.

def read source · line 374 · raw

@+path:String -> IO(Result<&1, &1, Pair(U32, String), 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Table>)

Reads one decoded block at a time and returns only after footer validation.