src/DurableBatchPolicy.bend checks
raw source on the hub · import mylsm-lsm-store@0.6.0.1/src/DurableBatchPolicy.bend as DurableBatchPolicy
6 imports
import Base import ./ByteWal.bend as ByteWal import ./StorageBytes.bend as StorageBytes import ./Wal.bend as Wal import ./coordinator/QueuePolicy.bend as QueuePolicy import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
Types
type ByteBatchMeasureState source · line 9 · raw
Type
Carries the owned input and accumulated exact batch size through the fold.
MeasureNeed@mutations:List<&1, 0xdd46804cd6318755b753109f15ff3725/src/ByteWal.Mutation> -> @reversed:List<&1, 0xdd46804cd6318755b753109f15ff3725/src/ByteWal.Mutation> -> @count:Nat -> @record_bytes:Nat -> ByteBatchMeasureState
type ByteBatchMeasurement source · line 14 · raw
Type
Returns a measured list or rejects input exceeding the mutation-count bound.
BatchMeasured@mutations:List<&1, 0xdd46804cd6318755b753109f15ff3725/src/ByteWal.Mutation> -> @count:Nat -> @encoded_bytes:Nat -> ByteBatchMeasurement
BatchTooManyByteBatchMeasurement
type Validation source · line 20 · raw
Data
Returns the count-limit decision for a mutation batch.
ValidBatchValidation
EmptyBatchValidation
BatchCountExceededValidation
BatchBytesExceededValidation
Definitions
def max_batch_count source · line 27 · raw
Nat
Returns the maximum number of mutations in a batch.
def max_batch_bytes source · line 31 · raw
Nat
Caps an encoded multi-mutation WAL frame at the normal block size.
def max_single_batch_bytes source · line 35 · raw
Nat
Retains the codec's one-record exception to the normal frame limit.
def frame_byte_limit source · line 39 · raw
@count:Nat -> @batch_limit:Nat -> @single_limit:Nat -> Nat
Selects the encoded-frame ceiling for a single record or mutation batch.
def put_record_bytes source · line 47 · raw
@key_bytes:Nat -> @value_bytes:Nat -> Nat
Counts one encoded Put record's tag, length fields, key, and value.
def delete_record_bytes source · line 51 · raw
@key_bytes:Nat -> Nat
Counts one encoded Delete record's tag, length field, and key.
def validate_frame_bytes source · line 55 · raw
@count:Nat -> @encoded_bytes:Nat -> @batch_limit:Nat -> @single_limit:Nat -> Validation
Decides whether one encoded frame is within its selected byte ceiling.
def frame_bytes source · line 66 · raw
@record_bytes:Nat -> Nat
Adds the fixed generation-four WAL frame header and checksum size.
def byte_batch.measure.loop source · line 70 · raw
@fuel:Nat -> @state:ByteBatchMeasureState -> ByteBatchMeasurement
Advances a bounded no-copy byte-batch size pass.
def byte_batch.measure source · line 109 · raw
@mutations:List<&1, 0xdd46804cd6318755b753109f15ff3725/src/ByteWal.Mutation> -> ByteBatchMeasurement
Measures a byte batch without copying buffers or building its WAL frame.
def within_batch_count source · line 116 · raw
@count:Nat -> Bool
Checks whether a batch count is within the allowed range.
def validate_count source · line 120 · raw
@count:Nat -> Validation
Rejects empty and oversized batches before writing.
def validate_batch.counted source · line 128 · raw
@count:Nat -> @encoded_bytes:Nat -> @count_validation:Validation -> Validation
Applies the byte limit only after the mutation count is accepted.
def validate_batch.copies source · line 142 · raw
@counts:Pair(Nat, Nat) -> @encoded_bytes:Nat -> Validation
Rejects a batch before storage access if its count or frame bytes exceed limits.
def validate_batch source · line 152 · raw
@count:Nat -> @encoded_bytes:Nat -> Validation
Rejects a batch before storage access if its count or frame bytes exceed limits.