src/transfer/LegacyWal.bend checks
raw source on the hub · import mylsm-lsm-store@0.6.0.0/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.
WalValid@frames:Nat -> VerifyResult
WalInvalidVerifyResult
type ReplayResult source · line 12 · raw
Data
Returns all validated legacy WAL batches in their durable order.
ReplayValid@batches:List<&2, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> ReplayResult
ReplayInvalidReplayResult
type ReplayState source · line 17 · raw
Type
Carries bounded offsets and decoded batches through read-only replay.
ReplayNeed@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @offset:Nat -> @batches:List<&2, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> ReplayState
ReplayMeasured@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @offset:Nat -> @batches:List<&2, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> @size:U32 -> ReplayState
ReplayBound@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @offset:Nat -> @batches:List<&2, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> @total:Nat -> @at_end:Bool -> @has_length:Bool -> ReplayState
ReplayLength@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @next_offset:Nat -> @total:Nat -> @batches:List<&2, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> @length:Maybe<&2, U32> -> ReplayState
ReplayFrame@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @next_offset:Nat -> @frame_end:Nat -> @batches:List<&2, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> @length:U32 -> @fits:Bool -> ReplayState
ReplayDecoded@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @next_offset:Nat -> @batches:List<&2, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> @result:Result<&1, &1, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Error, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> ReplayState
type WalkState source · line 31 · raw
Type
Carries the read-only legacy WAL parser across bounded pure transitions.
Header@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> WalkState
HeaderDecoded@source:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @result:Result<&1, &1, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Error, Unit> -> WalkState
HeaderMeasured@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, U32) -> WalkState
HeaderSeek@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor, Bool) -> WalkState
Read@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @frames:Nat -> WalkState
Remaining@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor, U32) -> @frames:Nat -> WalkState
Empty@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @remaining:Nat -> @frames:Nat -> WalkState
EmptyChecked@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @remaining:Nat -> @frames:Nat -> @empty:Bool -> WalkState
HasLength@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @remaining:Nat -> @frames:Nat -> @has_length:Bool -> WalkState
Length@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor, Maybe<&2, U32>) -> @remaining:U32 -> @frames:Nat -> WalkState
Bounds@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @length:U32 -> @frames:Nat -> @valid:Bool -> WalkState
Position@cursor:0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor -> @positions:Pair(Nat, Nat) -> @frame_bytes:U32 -> @frame_length:U32 -> @frames:Nat -> WalkState
Frame@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> @end:U32 -> @frames:Nat -> WalkState
Decoded@result:Result<&1, &1, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Error, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> @source:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @end:U32 -> @frames:Nat -> WalkState
Seek@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Cursor, Bool) -> @frames:Nat -> WalkState
Finish@frames:Nat -> WalkState
InvalidWalkState
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, 0x8f9a5c58059f5db5361cb2eddb73ec7f/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, 0x8f9a5c58059f5db5361cb2eddb73ec7f/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, 0x8f9a5c58059f5db5361cb2eddb73ec7f/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, 0x8f9a5c58059f5db5361cb2eddb73ec7f/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, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> ReplayState
def replay.length.state source · line 287 · raw
@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @offset:Nat -> @total:Nat -> @batches:List<&2, 0x8f9a5c58059f5db5361cb2eddb73ec7f/src/Wal.Batch> -> ReplayState
def replay.frame.measured source · line 296 · raw
@bytes:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @batches:List<&2, 0x8f9a5c58059f5db5361cb2eddb73ec7f/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, 0x8f9a5c58059f5db5361cb2eddb73ec7f/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, 0x8f9a5c58059f5db5361cb2eddb73ec7f/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, 0x8f9a5c58059f5db5361cb2eddb73ec7f/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.