~/bend-docscommunity

event_family_runtime.bend checks

raw source on the hub · import bendvy-ecs-core@0.1.0.6/event_family_runtime.bend as Event_family_runtime

6 imports
import Base
import ./world.bend as W
import ./event_runtime.bend as Ev
import ./ordinary_event_family.bend as Composition
import ./event_family_routing.bend as Route
import ./event_stream.bend as Leaf

Types

type State source · line 11 · raw

@P:Data -> @F:Type -> @H:Type -> Type

Advanced affine family state containing actual typed leaves F and owners H, with a shared Data publication journal and frame marker. It owns no second World. Canonical provisioning couples routes; raw callbacks remain trusted setup.

Templates

template setup source · line 16 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Data -> @-D:Data -> @-F:Type -> @-H:Type -> @-make:(@_:D -> @_:Nat -> F) -> @-sync:(@_:F -> @_:Nat -> @_:List<&2, P> -> F) -> @-frame:(@_:F -> @_:Nat -> F) -> @-retain:(@_:F -> @_:Nat -> @_:List<&2, P> -> Pair(F, List<&2, P>)) -> @-inventory:(@_:F -> Pair(F, List<&2, String>)) -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, P> -> @provision:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_event_family.Provision<S, P, D, F, make, sync, frame, retain, inventory> -> @owners:H -> @capacity:Nat -> 0x14a72e1c180a5ab1f8a056d43822425c/event_family_routing.Runtime<S, C, R, P, State<P, F, H>>

Create typed leaves from the canonical Provision domains/capacity, retaining actual World and supplied H owners with empty journal/tick zero. Does not register readers or automatically synchronize an existing World publication log.

template synchronize_world source · line 19 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Data -> @-F:Type -> @-H:Type -> @-sync:(@_:F -> @_:Nat -> @_:List<&2, P> -> F) -> @state:State<P, F, H> -> @+tick:Nat -> @observed:Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, P>, List<&2, P>) -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, P>, State<P, F, H>)

template synchronize source · line 29 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Data -> @-F:Type -> @-H:Type -> @-sync:(@_:F -> @_:Nat -> @_:List<&2, P> -> F) -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, P> -> @state:State<P, F, H> -> @tick:Nat -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, P>, State<P, F, H>)

Advanced publication synchronization: thread actual World/state and distribute World log suffix beyond journal length through the generated sync callback. Append nonempty suffix batches at the supplied tick. Caller must preserve the log/journal prefix invariant; this does not execute a barrier or advance readers.

template kept_batch source · line 31 · raw

@-P:Data -> @keep:Bool -> @tick:Nat -> @records:List<&2, P> -> @journal:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>> -> List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>>

template kept_batch_returned source · line 35 · raw

@-P:Data -> @-F:Type -> @tick:Nat -> @+records:List<&2, P> -> @returned:Pair(F, List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>>) -> Pair(F, List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>>)

template kept_batch_head source · line 38 · raw

@-P:Data -> @-F:Type -> @rest:(@_:F -> Pair(F, List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>>)) -> @tick:Nat -> @returned:Pair(F, List<&2, P>) -> Pair(F, List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>>)

template retained_journal source · line 41 · raw

@-P:Data -> @-F:Type -> @-retain:(@_:F -> @_:Nat -> @_:List<&2, P> -> Pair(F, List<&2, P>)) -> @journal:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>> -> @family:F -> Pair(F, List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>>)

template framed_journal source · line 45 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Data -> @-F:Type -> @-H:Type -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, P> -> @owners:H -> @+tick:Nat -> @returned:Pair(F, List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>>) -> 0x14a72e1c180a5ab1f8a056d43822425c/event_family_routing.Runtime<S, C, R, P, State<P, F, H>>

template frame source · line 52 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Data -> @-F:Type -> @-H:Type -> @-frame:(@_:F -> @_:Nat -> F) -> @-retain:(@_:F -> @_:Nat -> @_:List<&2, P> -> Pair(F, List<&2, P>)) -> @runtime:0x14a72e1c180a5ab1f8a056d43822425c/event_family_routing.Runtime<S, C, R, P, State<P, F, H>> -> 0x14a72e1c180a5ab1f8a056d43822425c/event_family_routing.Runtime<S, C, R, P, State<P, F, H>>

Apply each generated family frame/retention operation at current routing tick, retain only still-represented journal records, and replace World event log with those retained values. Return actual family/owners/World; no gameplay dispatch or implicit affine payload-log retirement is added to this Data layer.

template inventory_returned source · line 55 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Data -> @-F:Type -> @-H:Type -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, P> -> @owners:H -> @journal:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>> -> @frameStart:Nat -> @tick:Nat -> @returned:Pair(F, List<&2, String>) -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/event_family_routing.Runtime<S, C, R, P, State<P, F, H>>, List<&2, String>)

template inventory_optional source · line 58 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Data -> @-F:Type -> @-H:Type -> @returned:Pair(0x14a72e1c180a5ab1f8a056d43822425c/event_family_routing.Runtime<S, C, R, P, State<P, F, H>>, List<&2, String>) -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/event_family_routing.Runtime<S, C, R, P, State<P, F, H>>, Maybe<&2, List<&2, String>>)

template inventory_enabled source · line 64 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Data -> @-F:Type -> @-H:Type -> @-inventory:(@_:F -> Pair(F, List<&2, String>)) -> @enabled:Bool -> @runtime:0x14a72e1c180a5ab1f8a056d43822425c/event_family_routing.Runtime<S, C, R, P, State<P, F, H>> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/event_family_routing.Runtime<S, C, R, P, State<P, F, H>>, Maybe<&2, List<&2, String>>)

Return actual Runtime and optional detached family inventory. Disabled bypasses the inventory callback; enabled threads actual F through it. No synchronization, trim, frame or reader acknowledgement is performed by this observation.

template selected_state source · line 69 · raw

@-S:Data -> @-E:Data -> @-P:Data -> @-F:Type -> @-H:Type -> @owners:H -> @journal:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/event_runtime.Batch<P>> -> @frameStart:Nat -> @returned:Pair(F, 0x14a72e1c180a5ab1f8a056d43822425c/event_stream.Stream<S, E>) -> Pair(State<P, F, H>, 0x14a72e1c180a5ab1f8a056d43822425c/event_stream.Stream<S, E>)

template take source · line 75 · raw

@-S:Data -> @-E:Data -> @-P:Data -> @-F:Type -> @-H:Type -> @-take:(@_:F -> Pair(F, 0x14a72e1c180a5ab1f8a056d43822425c/event_stream.Stream<S, E>)) -> @state:State<P, F, H> -> Pair(State<P, F, H>, 0x14a72e1c180a5ab1f8a056d43822425c/event_stream.Stream<S, E>)

Trusted selector adapter extracting a copied Data stream while retaining actual family/owners/journal. Selector coherence comes from canonical provision, not a universal ownership or route-validity check in this wrapper.

template put source · line 81 · raw

@-S:Data -> @-E:Data -> @-P:Data -> @-F:Type -> @-H:Type -> @-put:(@_:F -> @_:0x14a72e1c180a5ab1f8a056d43822425c/event_stream.Stream<S, E> -> F) -> @state:State<P, F, H> -> @stream:0x14a72e1c180a5ab1f8a056d43822425c/event_stream.Stream<S, E> -> State<P, F, H>

Trusted selector adapter reinserting a Data stream into actual family state, preserving owners/journal/frame marker. Does not validate arbitrary stream origin or manufacture a reader capability.