owned_event_storage.bend checks
raw source on the hub · import bendvy-ecs-core@0.1.0.0/owned_event_storage.bend as Owned_event_storage
6 imports
import Base import ./world.bend as W import ./world_resource_owner.bend as Resource import ./event_runtime.bend as Ev import ./capabilities.bend as Cap import ./owned_event_log.bend as Log
Types
type Resources source · line 10 · raw
@R:Type -> @P:Type -> Type
Trusted schema storage: user resources and each affine payload log have one owner. Data IDs use the existing event runtime; its cursor/lag/retention policy is unchanged.
Resources@R:Type -> @P:Type -> @resource:R -> @log:0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Log<P> -> Resources<R, P>
Templates
template World source · line 12 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> Type
template Runtime source · line 13 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> Type
template resources_returned source · line 16 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-Out:Type -> @rest:0x296ca5f551e3792cd56cfc8122905b94/world_resource_owner.Rest<S, C, Resources<R, P>, Nat> -> @returned:Pair(Resources<R, P>, Out) -> Pair(World(S, C, R, P), Out)
Canonical World resource splitting preserves every non-resource field.
template resources_taken source · line 19 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-Out:Type -> @effect:(@_:Resources<R, P> -> Pair(Resources<R, P>, Out)) -> @taken:Pair(0x296ca5f551e3792cd56cfc8122905b94/world_resource_owner.Rest<S, C, Resources<R, P>, Nat>, Resources<R, P>) -> Pair(World(S, C, R, P), Out)
template with_resources source · line 22 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-Out:Type -> @effect:(@_:Resources<R, P> -> Pair(Resources<R, P>, Out)) -> @world:World(S, C, R, P) -> Pair(World(S, C, R, P), Out)
template appended source · line 25 · raw
@-R:Type -> @-P:Type -> @resource:R -> @result:Pair(0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Log<P>, List<&2, Nat>) -> Pair(Resources<R, P>, List<&2, Nat>)
template append_resources source · line 28 · raw
@-R:Type -> @-P:Type -> @values:List<&1, P> -> @resources:Resources<R, P> -> Pair(Resources<R, P>, List<&2, Nat>)
template publish_ids source · line 31 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @result:Pair(World(S, C, R, P), List<&2, Nat>) -> World(S, C, R, P)
template commit_owned source · line 36 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @world:World(S, C, R, P) -> @values:List<&1, P> -> World(S, C, R, P)
Called only after successful canonical transaction finish: owners and IDs publish in the same FIFO order. Failure/abort transport remains the ordinary adapter's job.
template retained source · line 39 · raw
@-R:Type -> @-P:Type -> @resource:R -> @result:Pair(0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Log<P>, List<&1, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Row<P>>) -> Pair(Resources<R, P>, List<&1, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Row<P>>)
template retain_resources source · line 42 · raw
@-R:Type -> @-P:Type -> @ids:List<&2, Nat> -> @resources:Resources<R, P> -> Pair(Resources<R, P>, List<&1, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Row<P>>)
template drain_resources source · line 45 · raw
@-R:Type -> @-P:Type -> @resources:Resources<R, P> -> Pair(Resources<R, P>, List<&1, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Row<P>>)
template runtime_returned source · line 48 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-Out:Type -> @namespace:U32 -> @batches:List<&2, 0x296ca5f551e3792cd56cfc8122905b94/event_runtime.Batch<Nat>> -> @positions:List<&2, 0x296ca5f551e3792cd56cfc8122905b94/event_runtime.Position> -> @nextReader:U32 -> @tick:Nat -> @frameStart:Nat -> @boundary:Nat -> @capacity:Nat -> @dropped:Nat -> @result:Pair(World(S, C, R, P), Out) -> Pair(Runtime(S, C, R, P), Out)
template framed source · line 51 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @runtime:Runtime(S, C, R, P) -> Pair(Runtime(S, C, R, P), List<&1, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Row<P>>)
template frame source · line 57 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @runtime:Runtime(S, C, R, P) -> Pair(Runtime(S, C, R, P), List<&1, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Row<P>>)
Existing Ev.frame chooses surviving complete batches. Return every other payload owner once; the caller chooses reuse or release, with no automatic IO finalizer.
template cleared_events source · line 59 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @result:Pair(World(S, C, R, P), List<&1, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Row<P>>) -> Pair(World(S, C, R, P), List<&1, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Row<P>>)
template drain source · line 64 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @runtime:Runtime(S, C, R, P) -> Pair(Runtime(S, C, R, P), List<&1, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Row<P>>)
Shutdown clears only queued IDs/batches and log rows. Preserve reader/runtime metadata and Log.next so old IDs cannot alias a later appended payload.
template read_returned source · line 69 · raw
@-R:Type -> @-P:Type -> @-Args:Type -> @-Observation:Type -> @resource:R -> @result:Pair(0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.Log<P>, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.ReadResult<Args, Observation>) -> Pair(Resources<R, P>, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.ReadResult<Args, Observation>)
template read_resources source · line 72 · raw
@-R:Type -> @-P:Type -> @-Request:Type -> @-Projection:Data -> @-Args:Type -> @-Observation:Type -> @-at:(@_:P -> @_:Request -> Pair(P, Projection)) -> @-body:(@-H:Type -> @-read:0x296ca5f551e3792cd56cfc8122905b94/capabilities.Request<H, Request, Projection> -> @_:H -> @_:Args -> Pair(H, Observation)) -> @resources:Resources<R, P> -> @id:Nat -> @args:Args -> Pair(Resources<R, P>, 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.ReadResult<Args, Observation>)
template read source · line 77 · raw
@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-Request:Type -> @-Projection:Data -> @-Args:Type -> @-Observation:Type -> @-at:(@_:P -> @_:Request -> Pair(P, Projection)) -> @-body:(@-H:Type -> @-read:0x296ca5f551e3792cd56cfc8122905b94/capabilities.Request<H, Request, Projection> -> @_:H -> @_:Args -> Pair(H, Observation)) -> @world:World(S, C, R, P) -> @id:Nat -> @args:Args -> Pair(World(S, C, R, P), 0x296ca5f551e3792cd56cfc8122905b94/owned_event_log.ReadResult<Args, Observation>)
The projection is trusted schema provisioning. The closed body receives only an abstract payload handle and declared scoped read request; it never gets World.