~/bend-docscommunity

src/SstStreamIo.bend relies on unsafe/foreign

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

7 imports
import Base
import ./Fs.bend as Fs
import ./SstReadPolicy.bend as SstReadPolicy
import ./MemTable.bend as MemTable
import ./Sstable.bend as Sstable
import ./SstFile.bend as SstFile
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

Types

type ExactResult source · line 34 · raw

Type

Represent ExactResult data used by the streaming SSTable filesystem effects.

type ExactState source · line 38 · raw

Type

Represent ExactState data used by the streaming SSTable filesystem effects.

type StreamReadState source · line 97 · raw

Type

Represent StreamReadState data used by the streaming SSTable filesystem effects.

type WriteState source · line 491 · raw

Type

Linear writer state keeps the file handle paired with the encoder result.

Definitions

def corruption_error_code source · line 10 · raw

U32

Returns the typed corruption code for SST codec failures.

def resource_limit_error_code source · line 14 · raw

U32

Returns the typed resource-limit code for bounded SST reads.

def codec_error source · line 18 · raw

@error:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.Error -> Pair(U32, String)

Map pure format errors to the storage IO error domain.

def exact.complete source · line 43 · raw

@file:File -> @chunks:List<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> @complete:Bool -> IO(Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>))

def exact.loop source · line 51 · raw

@fuel:Nat -> @state:ExactState -> IO(Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>))

def exact.start source · line 93 · raw

@file:File -> @+needed:Nat -> IO(Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>))

def read.exact.complete source · line 112 · raw

@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @complete:Bool -> Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>

def read.exact.state source · line 119 · raw

@pair:Pair(File, Result<&1, &1, Pair(U32, String), ExactResult>) -> Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>)

def read.header.parsed source · line 128 · raw

@file:File -> @+size:Nat -> @result:Result<&1, &1, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.Error, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.StreamState> -> StreamReadState

def read.header.state source · line 139 · raw

@pair:Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>) -> @+size:Nat -> StreamReadState

def read.block.header.bound source · line 149 · raw

@file:File -> @+size:Nat -> @+used:Nat -> @parser:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.StreamState -> @header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @+tail_len:U32 -> @valid:Bool -> StreamReadState

def read.block.header.size source · line 164 · raw

@file:File -> @+size:Nat -> @+used:Nat -> @parser:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.StreamState -> @header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @tail:Maybe<&2, U32> -> StreamReadState

def read.block.header.tail source · line 180 · raw

@saved:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @tail:Maybe<&2, U32> -> Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Maybe<&2, U32>)

def read.block.header.inspected source · line 186 · raw

@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Maybe<&2, U32>)

def read.block.header.copied source · line 193 · raw

@file:File -> @+size:Nat -> @+used:Nat -> @parser:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.StreamState -> @inspected:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Maybe<&2, U32>) -> StreamReadState

def read.block.header.copy source · line 207 · raw

@file:File -> @+size:Nat -> @+used:Nat -> @parser:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.StreamState -> @header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> StreamReadState

def read.block.header.state source · line 217 · raw

@pair:Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>) -> @+size:Nat -> @+used:Nat -> @parser:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.StreamState -> StreamReadState

def read.block.body.parsed source · line 229 · raw

@file:File -> @+size:Nat -> @+used:Nat -> @+tail_len:U32 -> @result:Result<&1, &1, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.Error, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.StreamState> -> StreamReadState

def read.block.body.state source · line 243 · raw

@pair:Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>) -> @+size:Nat -> @+used:Nat -> @parser:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.StreamState -> @header:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @+tail_len:U32 -> StreamReadState

def read.footer.parsed source · line 258 · raw

@file:File -> @result:Result<&1, &1, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.Error, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table> -> StreamReadState

def read.footer.size source · line 268 · raw

@file:File -> @parser:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.StreamState -> @bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @valid:Bool -> StreamReadState

def read.footer.state source · line 280 · raw

@pair:Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>) -> @+size:Nat -> @+used:Nat -> @parser:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.StreamState -> StreamReadState

def read.exhausted.file source · line 293 · raw

@file:File -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

def read.exhausted.pair source · line 298 · raw

@pair:Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>) -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

def read.exhausted source · line 305 · raw

@state:StreamReadState -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

def read.loop source · line 326 · raw

@fuel:Nat -> @state:StreamReadState -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

def read.table.opened source · line 370 · raw

@+size:Nat -> @opened:Result<&1, &1, Pair(U32, String), File> -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

def read.table.size.checked source · line 380 · raw

@+path:String -> @+size:Nat -> @valid:Bool -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

def read.table.size source · line 394 · raw

@+path:String -> @+size:Nat -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

def read.table.size.limited.decision source · line 398 · raw

@+path:String -> @+size:Nat -> @decision:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstReadPolicy.Decision -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

def read.table.size.limited source · line 413 · raw

@+path:String -> @+size:Nat -> @max_bytes:Nat -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

def read.table.limited.file_size source · line 421 · raw

@+path:String -> @max_bytes:Nat -> @result:Result<&1, &1, Pair(U32, String), Nat> -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

def read_table_limited source · line 433 · raw

@+path:String -> @max_bytes:Nat -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

Reads one SST only when its complete on-disk size fits the caller's budget.

def read.table.file_size source · line 442 · raw

@+path:String -> @result:Result<&1, &1, Pair(U32, String), Nat> -> IO(Result<&1, &1, Pair(U32, String), 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Sstable.Table>)

Read table for the streaming SSTable filesystem effects.

def read_table source · line 453 · raw

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

Reads and validates one SSTable while preserving IO errors.

def write.finish.chmod source · line 458 · raw

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

def write.finish.synced source · line 468 · raw

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

def write.finish source · line 481 · raw

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

def write.step source · line 498 · raw

@fuel:Nat -> @+path:String -> @state:WriteState -> IO(Result<&1, &1, Pair(U32, String), Unit>)

def write.encoder.opened source · line 543 · raw

@+path:String -> @fuel:Nat -> @encoder:0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.Encoder -> @opened:Result<&1, &1, Pair(U32, String), File> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

def write.encoder source · line 555 · raw

@+path:String -> @fuel:Nat -> @result:Result<&1, &1, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.Error, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/SstFile.Encoder> -> IO(Result<&1, &1, Pair(U32, String), Unit>)

def write_table source · line 569 · raw

@+path:String -> @+entries:List<&2, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/MemTable.Entry> -> @+level:U32 -> IO(Result<&1, &1, Pair(U32, String), Unit>)

Encode and write one SST as packed chunks, then sync it before publication.