src/transfer/RestoreIo.bend relies on unsafe/foreign
raw source on the hub · import mylsm-lsm-store@0.6.0.2/src/transfer/RestoreIo.bend as RestoreIo
10 imports
import Base import ../ByteDurableDb.bend as Db import ../ByteMemTable.bend as ByteMemTable import ../ByteWal.bend as ByteWal import ../CrashPoint.bend as CrashPoint import ../Fs.bend as Fs import ./Restore.bend as Restore import ./PublicationPolicy.bend as PublicationPolicy import ./RestorePolicy.bend as RestorePolicy import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
Types
type Error source · line 13 · raw
Data
Classifies exchange validation, staging, publication, and durability failures.
InvalidFormatError
ResourceLimitError
InvalidOrderError
ChecksumMismatchError
CountMismatchError
Storage@error:0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error -> Error
Io@code:U32 -> @message:String -> Error
DestinationExistsError
TemporaryExistsError
VerificationFailedError
CommitUnknown@code:U32 -> @message:String -> Error
type WriteState source · line 27 · raw
Type
Retains a single staged record and database handle between WAL writes.
WriteNeed@handle:0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle -> @entries:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> WriteState
WriteBatch@handle:0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle -> @page:WritePage -> WriteState
WriteResult@pair:Pair(0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle, Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, Unit>) -> @rest:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> WriteState
type WritePage source · line 34 · raw
Type
Carries one bounded mutation page and the remaining ordered entries.
WritePage@batch:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> @rest:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> WritePage
Definitions
def decode.error source · line 37 · raw
@error:0x7586b743ff7fd05e412d5115859629b6/src/transfer/Restore.Error -> Error
def write.finish source · line 45 · raw
@pair:Pair(0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle, Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, Unit>) -> WriteState
def write.result source · line 48 · raw
@rest:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> @pair:Pair(0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle, Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, Unit>) -> WriteState
def write.page.go source · line 54 · raw
@fuel:Nat -> @entries:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> @reversed:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> WritePage
def write.page.ready source · line 66 · raw
@measured:Pair(List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry>, Nat) -> WritePage
def write.page source · line 73 · raw
@entries:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> WritePage
def write.mutations source · line 76 · raw
@entries:List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry> -> List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteWal.Mutation>
def write.loop source · line 84 · raw
@fuel:Nat -> @state:WriteState -> IO(Pair(0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle, Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, Unit>))
def remove.ignored source · line 117 · raw
@path:String -> IO(Unit)
def cleanup.directory source · line 122 · raw
@+path:String -> IO(Unit)
def cleanup.result source · line 131 · raw
@path:String -> @result:Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, Unit> -> IO(Result<&1, &1, Error, Unit>)
def cleanup.handle source · line 145 · raw
@path:String -> @handle:0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle -> @error:0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error -> IO(Result<&1, &1, Error, Unit>)
def flush.closed source · line 154 · raw
@path:String -> @result:Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, Unit> -> IO(Result<&1, &1, Error, Unit>)
def flush.result source · line 162 · raw
@path:String -> @pair:Pair(0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle, Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, Unit>) -> IO(Result<&1, &1, Error, Unit>)
def write.result.path source · line 175 · raw
@path:String -> @pair:Pair(0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle, Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, Unit>) -> IO(Result<&1, &1, Error, Unit>)
def verify_count source · line 188 · raw
@path:String -> @equal:Bool -> IO(Result<&1, &1, Error, Unit>)
Rejects a staged database whose recovered entry count differs from the exchange.
def verified.closed source · line 196 · raw
@path:String -> @expected:Nat -> @count:Nat -> @closed:Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, Unit> -> IO(Result<&1, &1, Error, Unit>)
def path.reverse source · line 210 · raw
@path:String -> @reversed:String -> String
def path.clone source · line 216 · raw
@path:String -> String
def verified.stats source · line 220 · raw
@path:String -> @expected:Nat -> @pair:Pair(0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Stats) -> IO(Result<&1, &1, Error, Unit>)
def verified source · line 232 · raw
@path:String -> @expected:Nat -> @opened:Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle> -> IO(Result<&1, &1, Error, Unit>)
Opens and checks the staged database before publication.
def publish.parent.sync.failed source · line 245 · raw
@disposition:0x7586b743ff7fd05e412d5115859629b6/src/transfer/PublicationPolicy.Failure -> @error:Pair(U32, String) -> IO(Result<&1, &1, Error, Unit>)
Validates an exchange, builds a sibling database, verifies it, then publishes it.
def publish.parent.synced source · line 260 · raw
@result:Result<&1, &1, Pair(U32, String), Unit> -> IO(Result<&1, &1, Error, Unit>)
def publish.rename.failed source · line 273 · raw
@+temporary:String -> @disposition:0x7586b743ff7fd05e412d5115859629b6/src/transfer/PublicationPolicy.Failure -> @error:Pair(U32, String) -> IO(Result<&1, &1, Error, Unit>)
def publish.renamed source · line 290 · raw
@+destination:String -> @+temporary:String -> @result:Result<&1, &1, Pair(U32, String), Unit> -> IO(Result<&1, &1, Error, Unit>)
def publish.synced source · line 308 · raw
@+destination:String -> @+temporary:String -> @result:Result<&1, &1, Pair(U32, String), Unit> -> IO(Result<&1, &1, Error, Unit>)
def publish.verified source · line 327 · raw
@+destination:String -> @+temporary:String -> @result:Result<&1, &1, Error, Unit> -> IO(Result<&1, &1, Error, Unit>)
def publish source · line 341 · raw
@+destination:String -> @+temporary:String -> @expected:Nat -> IO(Result<&1, &1, Error, Unit>)
Reopens staged data and checks that recovery sees the expected record count.
def publish.result source · line 352 · raw
@destination:String -> @temporary:String -> @expected:Nat -> @populated:Result<&1, &1, Error, Unit> -> IO(Result<&1, &1, Error, Unit>)
def temporary.create source · line 363 · raw
@+destination:String -> @+temporary:String -> @created:Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Error, 0x7586b743ff7fd05e412d5115859629b6/src/ByteDurableDb.Handle> -> @measured:Pair(List<&1, 0x7586b743ff7fd05e412d5115859629b6/src/ByteMemTable.Entry>, Nat) -> IO(Result<&1, &1, Error, Unit>)
def temporary.decoded source · line 384 · raw
@+destination:String -> @+temporary:String -> @decoded:Result<&1, &1, 0x7586b743ff7fd05e412d5115859629b6/src/transfer/Restore.Error, 0x7586b743ff7fd05e412d5115859629b6/src/transfer/Restore.Decoded> -> IO(Result<&1, &1, Error, Unit>)
def temporary.checked source · line 400 · raw
@+destination:String -> @+temporary:String -> @input:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @result:Result<&1, &1, Pair(U32, String), Bool> -> IO(Result<&1, &1, Error, Unit>)
def destination.checked source · line 414 · raw
@+destination:String -> @+temporary:String -> @input:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @result:Result<&1, &1, Pair(U32, String), Bool> -> IO(Result<&1, &1, Error, Unit>)
def restore source · line 432 · raw
@+destination:String -> @input:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> IO(Result<&1, &1, Error, Unit>)
Validates an exchange before staging and atomically publishing a database.
def source.read.length source · line 441 · raw
@+destination:String -> @input:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @equal:Bool -> IO(Result<&1, &1, Error, Unit>)
def source.read.checked source · line 450 · raw
@+destination:String -> @+expected_size:Nat -> @input:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> IO(Result<&1, &1, Error, Unit>)
def source.read.result source · line 460 · raw
@+destination:String -> @+expected_size:Nat -> @pair:Pair(File, Result<&1, &1, Pair(U32, String), 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes>) -> IO(Result<&1, &1, Error, Unit>)
def source.opened source · line 475 · raw
@+destination:String -> @+size:Nat -> @opened:Result<&1, &1, Pair(U32, String), File> -> IO(Result<&1, &1, Error, Unit>)
def source.sized.checked source · line 489 · raw
@+destination:String -> @+source:String -> @size:Nat -> @valid:Bool -> IO(Result<&1, &1, Error, Unit>)
def source.sized source · line 503 · raw
@+destination:String -> @+source:String -> @+size:Nat -> IO(Result<&1, &1, Error, Unit>)
def source.size source · line 511 · raw
@+destination:String -> @+source:String -> @measured:Result<&1, &1, Pair(U32, String), Nat> -> IO(Result<&1, &1, Error, Unit>)
def restore_from source · line 522 · raw
@+destination:String -> @+bundle:String -> IO(Result<&1, &1, Error, Unit>)
Reads a bounded backup bundle file and restores its validated exchange.