~/bend-docscommunity

src/transfer/LegacyWal.bend checks

raw source on the hub · import mylsm-lsm-store@0.6.0.1/src/transfer/LegacyWal.bend as LegacyWal

4 imports
import Base
import ../coordinator/QueuePolicy.bend as QueuePolicy
import ../Wal.bend as Wal
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

Types

type VerifyResult source · line 7 · raw

Data

Reports a validated frame count or a malformed legacy WAL.

type ReplayResult source · line 12 · raw

Data

Returns all validated legacy WAL batches in their durable order.

type ReplayState source · line 17 · raw

Type

Carries bounded offsets and decoded batches through read-only replay.

type WalkState source · line 31 · raw

Type

Carries the read-only legacy WAL parser across bounded pure transitions.

Definitions

def walk.empty.checked source · line 52 · raw

@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @frames:Nat -> @copies:Pair(Nat, Nat) -> WalkState

Separates an empty log suffix from the next frame-length transition.

def walk.length.checked source · line 62 · raw

@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @frames:Nat -> @copies:Pair(Nat, Nat) -> WalkState

Checks that a nonempty log suffix contains a complete frame-length word.

def walk.nat.clone.remainder source · line 71 · raw

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

def walk.nat.clone.pair source · line 78 · raw

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

def walk.nat.clone.triple source · line 84 · raw

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

def walk.length.copies.for.cursor source · line 87 · raw

@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @remaining:U32 -> @frames:Nat -> @pair:Pair(Nat, Pair(Nat, Nat)) -> WalkState

def walk.length.validated source · line 99 · raw

@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @remaining:U32 -> @frames:Nat -> @length:U32 -> WalkState

def walk.position.measured source · line 109 · raw

@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor, U32) -> @frames:Nat -> @lengths:Pair(Nat, Nat) -> WalkState

Prepares independent frame-size and endpoint lengths for the cursor state.

def walk.position.state source · line 122 · raw

@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @frames:Nat -> @lengths:Pair(Nat, Nat) -> WalkState

def walk source · line 130 · raw

@fuel:Nat -> @state:WalkState -> VerifyResult

Applies one pure parser transition, rejecting malformed or truncated frames.

def verify.measured source · line 212 · raw

@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, U32) -> VerifyResult

Converts the file byte count into a finite transition bound.

def verify source · line 220 · raw

@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> VerifyResult

Validates a complete generation-three WAL without repairing its bytes.

def replay.measure source · line 223 · raw

@measured:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, U32) -> @offset:Nat -> @batches:List<&2, 0xdd46804cd6318755b753109f15ff3725/src/Wal.Batch> -> ReplayState

def replay.nat.clone.remainder source · line 231 · raw

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

def replay.nat.clone.pair source · line 235 · raw

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

def replay.nat.clone.triple source · line 240 · raw

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

def replay.bound.measured source · line 243 · raw

@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @batches:List<&2, 0xdd46804cd6318755b753109f15ff3725/src/Wal.Batch> -> @offsets:Pair(Nat, Pair(Nat, Nat)) -> @totals:Pair(Nat, Pair(Nat, Nat)) -> ReplayState

def replay.bound.state source · line 257 · raw

@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @offset:Nat -> @batches:List<&2, 0xdd46804cd6318755b753109f15ff3725/src/Wal.Batch> -> @total:Nat -> ReplayState

def replay.length.pair source · line 266 · raw

@measured:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Maybe<&2, U32>) -> @next_offset:Nat -> @total:Nat -> @batches:List<&2, 0xdd46804cd6318755b753109f15ff3725/src/Wal.Batch> -> ReplayState

def replay.length.indexed source · line 276 · raw

@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @offsets:Pair(Nat, Nat) -> @total:Nat -> @batches:List<&2, 0xdd46804cd6318755b753109f15ff3725/src/Wal.Batch> -> ReplayState

def replay.length.state source · line 287 · raw

@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @offset:Nat -> @total:Nat -> @batches:List<&2, 0xdd46804cd6318755b753109f15ff3725/src/Wal.Batch> -> ReplayState

def replay.frame.measured source · line 296 · raw

@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @batches:List<&2, 0xdd46804cd6318755b753109f15ff3725/src/Wal.Batch> -> @total:Nat -> @offsets:Pair(Nat, Nat) -> @lengths:Pair(Nat, Nat) -> ReplayState

def replay.frame.state source · line 313 · raw

@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @next_offset:Nat -> @total:Nat -> @batches:List<&2, 0xdd46804cd6318755b753109f15ff3725/src/Wal.Batch> -> @length:U32 -> ReplayState

def replay.frame.decoded source · line 324 · raw

@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> @frame_end:Nat -> @batches:List<&2, 0xdd46804cd6318755b753109f15ff3725/src/Wal.Batch> -> ReplayState

def replay.loop source · line 333 · raw

@fuel:Nat -> @state:ReplayState -> ReplayResult

def replay.header.validated source · line 372 · raw

@source:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @fuel:Nat -> @validation:Result<&1, &1, 0xdd46804cd6318755b753109f15ff3725/src/Wal.Error, Unit> -> ReplayResult

def replay.header.pair source · line 381 · raw

@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> @fuel:Nat -> ReplayResult

def replay.measured source · line 390 · raw

@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, U32) -> ReplayResult

Derives replay fuel from the source size and validates the header before decoding frames.

def replay source · line 397 · raw

@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> ReplayResult

Validates and replays all frames without repairing or truncating the source.