~/bend-docscommunity

src/SstStreamIo.bend relies on unsafe/foreign

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

6 imports
import Base
import ./Fs.bend as Fs
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 29 · raw

Type

Represent ExactResult data used by the streaming SSTable filesystem effects.

type ExactState source · line 33 · raw

Type

Represent ExactState data used by the streaming SSTable filesystem effects.

type StreamReadState source · line 92 · raw

Type

Represent StreamReadState data used by the streaming SSTable filesystem effects.

type WriteState source · line 443 · raw

Type

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

Definitions

def corruption_error_code source · line 9 · raw

U32

Returns the typed corruption code for SST codec failures.

def codec_error source · line 13 · raw

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

Map pure format errors to the storage IO error domain.

def exact.complete source · line 38 · 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 46 · raw

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

def exact.start source · line 88 · raw

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

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

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

def read.exact.state source · line 114 · 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 123 · raw

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

def read.exhausted source · line 300 · raw

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

def read.loop source · line 321 · raw

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

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

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

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

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

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

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

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

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

Read table for the streaming SSTable filesystem effects.

def read_table source · line 405 · raw

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

Reads and validates one SSTable while preserving IO errors.

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

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

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

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

def write.finish source · line 433 · raw

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

def write.step source · line 450 · raw

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

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

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

def write.encoder source · line 507 · raw

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

def write_table source · line 521 · raw

@+path:String -> @+entries:List<&2, 0x4fcd94fa965aa1443134557fd075a483/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.