~/bend-docscommunity

src/scan/ByteRange.bend checks

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

3 imports
import Base
import ../Keys.bend as Keys
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

Definitions

def clone.pair source · line 6 · raw

@+len:U32 -> @copied:Pair(Array<U32>, Array<U32>) -> Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes)

Reifies two independently owned copies of a byte buffer.

def clone.split source · line 12 · raw

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

Clones a byte buffer when range checks need both bounds.

def lower.result source · line 18 · raw

@comparison:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Cmp)) -> Bool

Returns whether a key satisfies an optional inclusive lower bound.

def lower source · line 26 · raw

@key:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @bound:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> Bool

Checks an optional lower bound using the canonical byte comparator.

def upper.result source · line 34 · raw

@comparison:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Cmp)) -> Bool

Returns whether a key sorts strictly below an optional upper bound.

def upper source · line 42 · raw

@key:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @bound:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> Bool

Checks an optional exclusive upper bound using byte order.

def at_or_after_upper.result source · line 49 · raw

@comparison:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Cmp)) -> Bool

def at_or_after_upper source · line 55 · raw

@key:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @bound:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> Bool

Detects the first ordered key that cannot belong to a half-open range.

def in_range.checked source · line 62 · raw

@lower_ok:Bool -> @upper_ok:Bool -> Bool

Combines the lower and upper checks for a half-open range.

def in_range.copies source · line 70 · raw

@copies:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> @lower_bound:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> @upper_bound:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> Bool

Checks a byte key against optional [lower, upper) bounds.

def in_range source · line 80 · raw

@key:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @lower_bound:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> @upper_bound:Maybe<&1, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes> -> Bool

Checks a byte key against optional [lower, upper) bounds.

def prefix.equal source · line 88 · raw

@result:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Bool)) -> Bool

Returns the equality component while consuming both preserved buffers.

def prefix.slice.result source · line 94 · raw

@prefix:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, 0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes) -> Bool

Compares a bounded key prefix with the requested bytes.

def prefix.slice source · line 103 · raw

@key:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @prefix:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @+prefix_len:U32 -> Bool

Slices exactly the requested prefix length and compares the resulting bytes.

def prefix.length.checked source · line 107 · raw

@key:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @prefix:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @+prefix_len:U32 -> @+key_len:U32 -> Bool

Rejects prefixes longer than the key before slicing.

def prefix.lengths source · line 117 · raw

@key_pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, U32) -> @prefix_pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, U32) -> Bool

Unpacks measured key and prefix lengths before comparison.

def has_prefix source · line 128 · raw

@key:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @prefix:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> Bool

Checks whether a byte key begins with the exact byte prefix.