event_stream.bend checks
raw source on the hub · import bendvy-ecs-core@0.1.0.5/event_stream.bend as Event_stream
3 imports
import Base import ./event_runtime.bend as Ev import ./ordinary_event_declaration.bend as Event
Types
type Stream source · line 9 · raw
@S:Data -> @E:Data -> Data
Detached Data metadata; the containing application retains the sole affine World. Detached typed stream metadata: ordered Data batches and activated reader positions with retention accounting. It owns no World or affine payload log; raw construction/selection belongs to trusted family provisioning.
Stream@S:Data -> @E:Data -> @domain:0x2a0aaf4f2cb3f416a9b91fd887916a5d/ordinary_event_declaration.Domain<S, E> -> @batches:List<&2, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/event_runtime.Batch<E>> -> @positions:List<&2, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/event_runtime.Position> -> @nextReader:U32 -> @frameStart:Nat -> @boundary:Nat -> @capacity:Nat -> @dropped:Nat -> Stream<S, E>
Definitions
def completed_positions source · line 67 · raw
@success:Bool -> @+positions:List<&2, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/event_runtime.Position> -> @+id:U32 -> @+tick:Nat -> List<&2, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/event_runtime.Position>
Templates
template provision source · line 12 · raw
@-S:Data -> @-E:Data -> @domain:0x2a0aaf4f2cb3f416a9b91fd887916a5d/ordinary_event_declaration.Domain<S, E> -> @capacity:Nat -> Stream<S, E>
Initialize an empty stream for a declared domain/capacity. No reader is active.
template can_register source · line 15 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> Bool
Check remaining U32 reader-id space, without allocating or activating a reader.
template increment_reader source · line 18 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> @+tick:Nat -> Pair(Stream<S, E>, U32)
template registered_checked source · line 21 · raw
@-S:Data -> @-E:Data -> @available:Bool -> @stream:Stream<S, E> -> @+tick:Nat -> Pair(Stream<S, E>, U32)
template append source · line 27 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> @tick:Nat -> @+values:List<&2, E> -> Stream<S, E>
Append nonempty Data publications at the supplied tick using runtime batch rules. Does not advance readers or trim capacity; caller supplies ordered publication data.
template registered source · line 33 · raw
@-S:Data -> @-E:Data -> @+stream:Stream<S, E> -> @+tick:Nat -> Pair(Stream<S, E>, U32)
Allocate the next reader id, returning zero on exhaustion with stream unchanged. Does not activate its position or deliver unread data; routing checks admission before using this low-level result.
template read_position source · line 35 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> @+id:U32 -> @+tick:Nat -> @position:Maybe<&1, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/event_runtime.Position> -> Pair(Stream<S, E>, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/event_runtime.Reading<E>)
template reading source · line 42 · raw
@-S:Data -> @-E:Data -> @+stream:Stream<S, E> -> @+id:U32 -> @+tick:Nat -> Pair(Stream<S, E>, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/event_runtime.Reading<E>)
Read ordered unread Data plus lag status using an existing position, or a not-yet-activated position for id/tick. Returns stream metadata without advancing its cursor. This helper does not validate an external reader token or World.
template advance source · line 47 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> @+id:U32 -> @+tick:Nat -> Stream<S, E>
Activate id if needed then advance its cursor to tick. Trusted completion operation, not an independent registration/provenance validation.
template trimmed source · line 50 · raw
@-S:Data -> @-E:Data -> @domain:0x2a0aaf4f2cb3f416a9b91fd887916a5d/ordinary_event_declaration.Domain<S, E> -> @positions:List<&2, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/event_runtime.Position> -> @nextReader:U32 -> @frameStart:Nat -> @boundary:Nat -> @capacity:Nat -> @trimmed:0x2a0aaf4f2cb3f416a9b91fd887916a5d/event_runtime.Trimmed<E> -> Stream<S, E>
template frame source · line 56 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> @+tick:Nat -> Stream<S, E>
Apply frame-window and capacity trimming with current active-reader holds. Return metadata with updated boundaries/dropped history; hard capacity can cause lag, so active readers do not promise indefinite retention.
template inventory source · line 60 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> String
Return the detached authored domain key without reading message payloads.
template dropped source · line 64 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> Nat
Return the dropped-through history marker, not a message count.
template completed source · line 74 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> @id:U32 -> @tick:Nat -> @success:Bool -> Stream<S, E>
Update one reader after execution: success advances to tick; failure preserves unread position while activating absent position under failed-reader rules. Caller supplies actual id/outcome; this does not execute or validate a callback.
template read_declaration source · line 78 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> 0x2a0aaf4f2cb3f416a9b91fd887916a5d/ordinary_event_declaration.Declaration<S, E>
Derive read-mode declaration from the retained stream domain, not a new writer grant.
template domain source · line 82 · raw
@-S:Data -> @-E:Data -> @stream:Stream<S, E> -> 0x2a0aaf4f2cb3f416a9b91fd887916a5d/ordinary_event_declaration.Domain<S, E>
Project the retained typed domain; metadata alone is not reader ownership.