~/bend-docscommunity

src/coordinator/CursorOpenCodec.bend checks

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

5 imports
import Base
import ./Protocol.bend as Protocol
import ../scan/RangeCursor.bend as RangeCursor
import ../ByteMemTable.bend as ByteMemTable
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

Types

type Request source · line 8 · raw

Type

Carries one exact range or prefix request for an owner snapshot cursor.

type Decision source · line 12 · raw

Type

Reports a decoded cursor-open request or malformed argument bytes.

type BoundResult source · line 17 · raw

Type

Carries an input buffer, one parsed optional bound, and its next offset.

type RangeResult source · line 22 · raw

Type

Carries both range bounds after parsing the lower bound.

Definitions

def bound.absent source · line 28 · raw

0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes

Encodes an absent bound with a reserved length outside the admitted frame cap.

def bound.present source · line 32 · raw

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

Encodes one present bound as a length followed by its raw bytes.

def bound.encode source · line 38 · raw

@value:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes

Encodes an optional bound without interpreting or transforming its bytes.

def encode.range source · line 44 · raw

@snapshot_id:U32 -> @lower:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> @upper:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes

Encodes one full range request with an owner snapshot token.

def encode.prefix source · line 53 · raw

@snapshot_id:U32 -> @prefix:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes

Encodes one byte-prefix request with an owner snapshot token.

def u32.duplicate.triple source · line 58 · raw

@+value:U32 -> Pair(U32, Pair(U32, U32))

Copies a fixed-width word without recursion on its numeric value.

def u32.duplicate.pair source · line 62 · raw

@+value:U32 -> Pair(U32, U32)

Duplicates one fixed-width word for two bounded offset calculations.

def field.sized.sliced source · line 66 · raw

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

Retains the source buffer while storing one exact bound slice.

def field.sized.checked source · line 74 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @offsets:Pair(U32, Pair(U32, U32)) -> @lengths:Pair(U32, U32) -> @fits:Bool -> BoundResult

Slices a validated span using separate copies for its start and end offsets.

def field.sized.decision source · line 94 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @offset:U32 -> @length:U32 -> @fits:Bool -> BoundResult

Selects a bounded raw-byte slice or rejects a span beyond the frame.

def field.sized.inputs source · line 104 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @totals:Pair(U32, U32) -> @offsets:Pair(U32, U32) -> @lengths:Pair(U32, U32) -> BoundResult

Separates validation inputs from the values passed to the slice decision.

def field.sized source · line 121 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @total:U32 -> @offset:U32 -> @length:U32 -> BoundResult

Validates the payload span before slicing one present bound.

def field.value.decision source · line 132 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @total:U32 -> @offset:U32 -> @length:U32 -> @absent:Bool -> BoundResult

Selects the absent sentinel or a validated present bound.

def field.value.inputs source · line 147 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @total:U32 -> @offset:U32 -> @lengths:Pair(U32, U32) -> BoundResult

Separates the sentinel check from the length passed to the bound parser.

def field.value source · line 159 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @total:U32 -> @offset:U32 -> @length:U32 -> BoundResult

Converts one field length into a bounded slice or an absent bound.

def field.length source · line 168 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @total:U32 -> @offset:U32 -> @parsed:Maybe<&2, U32> -> BoundResult

Checks that one field's four-byte length is available at its offset.

def field.read.parsed source · line 180 · raw

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

Parses one optional bound length from the supplied offset.

def field.read.copies source · line 190 · raw

@sources:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> @total:U32 -> @offsets:Pair(U32, U32) -> BoundResult

Keeps one source for slicing while reading its fixed-width length field.

def field.read source · line 203 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @total:U32 -> @offset:U32 -> BoundResult

Parses one optional bound length from the supplied offset.

def range.upper.result source · line 212 · raw

@result:BoundResult -> @lower:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> RangeResult

Combines both successfully parsed range bounds.

def range.upper.read source · line 222 · raw

@source:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @total:U32 -> @lower:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> @offset:U32 -> RangeResult

Reads the upper field from the source retained by lower-bound parsing.

def range.upper source · line 231 · raw

@lower_result:BoundResult -> @total:U32 -> RangeResult

Parses the upper bound after preserving the lower-bound result.

def range.finish.exact source · line 241 · raw

@exact:Bool -> @snapshot_id:U32 -> @lower:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> @upper:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> Decision

Rejects trailing bytes or returns the decoded range cursor request.

def range.finish source · line 254 · raw

@parsed:RangeResult -> @snapshot_id:U32 -> @total:U32 -> Decision

Builds a range request only when its fields consume the entire frame.

def range.decode.totals source · line 265 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @snapshot_id:U32 -> @totals:Pair(U32, Pair(U32, U32)) -> Decision

Parses range bounds with separate total lengths for IO-free validation.

def range.decode source · line 276 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @snapshot_id:U32 -> @total:U32 -> Decision

Parses both optional bounds and requires an exact request boundary.

def prefix.finish.exact source · line 285 · raw

@exact:Bool -> @snapshot_id:U32 -> @prefix:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> Decision

Rejects trailing bytes or returns the decoded prefix cursor request.

def prefix.finish source · line 297 · raw

@parsed:BoundResult -> @snapshot_id:U32 -> @total:U32 -> Decision

Builds a prefix request only when its field consumes the remaining frame.

def prefix.decode.totals source · line 309 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @snapshot_id:U32 -> @totals:Pair(U32, U32) -> Decision

Parses prefix bounds with separate lengths for reading and validation.

def prefix.decode source · line 319 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @snapshot_id:U32 -> @total:U32 -> Decision

Parses one present prefix bound and requires an exact request boundary.

def mode source · line 327 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @snapshot_id:U32 -> @total:U32 -> @parsed:Maybe<&2, U32> -> Decision

Selects range or prefix decoding from the exact mode word.

def mode.read.parsed source · line 339 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @snapshot_id:U32 -> @total:U32 -> @parsed:Maybe<&2, U32> -> Decision

Requires the mode field to exist before selecting a cursor-open shape.

def mode.read.field source · line 348 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @snapshot_id:U32 -> @total:U32 -> @field:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Maybe<&2, U32>) -> Decision

Projects one fixed-width mode parse while retaining its request source.

def mode.read.copies source · line 358 · raw

@sources:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> @snapshot_id:U32 -> @total:U32 -> Decision

Reads the mode from a copy while retaining the request for bound slicing.

def mode.read source · line 369 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @snapshot_id:U32 -> @total:U32 -> @enough:Bool -> Decision

Requires the mode field to exist before selecting a cursor-open shape.

def decode.payload.inputs source · line 381 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @totals:Pair(U32, U32) -> @parsed:Maybe<&2, U32> -> Decision

Decodes an owner token followed by one supported cursor-open mode.

def decode.payload source · line 395 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @total:U32 -> @parsed:Maybe<&2, U32> -> Decision

Decodes an owner token followed by one supported cursor-open mode.

def decode.payload.field source · line 403 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @total:U32 -> @field:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Maybe<&2, U32>) -> Decision

Projects one snapshot-token parse while retaining the full request.

def decode.payload.copies source · line 412 · raw

@sources:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> @total:U32 -> Decision

Decodes an owner token from one input copy and retains another for mode parsing.

def decode.measured source · line 421 · raw

@measured:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, U32) -> Decision

Decodes one bounded cursor-open request without interpreting its bytes.

def decode source · line 427 · raw

@payload:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> Decision

Decodes a full-range or prefix request from its exact wire payload.