~/bend-docscommunity

ordinary_owned_event.bend checks

raw source on the hub · import bendvy-ecs-core@0.1.0.5/ordinary_owned_event.bend as Ordinary_owned_event

6 imports
import Base
import ./world.bend as W
import ./system.bend as Sys
import ./transaction.bend as T
import ./commands.bend as Cmd
import ./owned_event_storage.bend as Storage

Types

type Domain source · line 12 · raw

@-S:Data -> @-P:Type -> Data

Ordinary identity derives publication metadata and the confined grant. Raw Frame and runner constructors are trusted engine administration. Schema/payload-indexed owned event name. Contains no live log or payload; raw names alone do not confer runtime publication or read authority.

type Frame source · line 28 · raw

@World:Type -> @P:Type -> Type

Trusted single-domain engine stage owning transaction and unpublished payloads. Gameplay receives abstract H through Write, not this raw constructor.

type Write source · line 32 · raw

@-S:Data -> @-P:Type -> @-identity:Domain<S, P> -> @-H:Type -> Type

Nominal publication grant consuming P and returning opaque H. It exposes no live payload alias; bound operation defines staging/commit/abort behavior.

type Reply source · line 50 · raw

@Error:Data -> @Out:Type -> @P:Type -> Type

Single-domain publication reply retaining body output and staged payload recovery. Failure returns available staged owners in emission order; success commits them and returns an empty recovery list. Inspect the inner outcome.

Templates

template domain source · line 16 · raw

@-S:Data -> @-P:Type -> @key:String -> Domain<S, P>

Declare a domain for arbitrary affine Type payload P without creating log storage, publishing a payload or allocating a reader.

template name source · line 18 · raw

@-S:Data -> @-P:Type -> @domain:Domain<S, P> -> String

Return the authored event domain key without accessing a log or payload.

template access source · line 23 · raw

@-S:Data -> @-P:Type -> @domain:Domain<S, P> -> @suffix:String -> String

Return authored domain name plus suffix for registration metadata. This string does not replace the typed grant or runtime World checks.

template emit_field source · line 36 · raw

@-S:Data -> @-P:Type -> @-identity:Domain<S, P> -> @-H:Type -> @grant:Write<S, P, identity, H> -> @_:H -> @_:P -> H

Advanced projection extracting the closed emission operation. Does not publish, validate a World or transfer any payload by itself.

template emit source · line 42 · raw

@-S:Data -> @-P:Type -> @-identity:Domain<S, P> -> @-H:Type -> @-grant:Write<S, P, identity, H> -> @owner:H -> @payload:P -> H

Consume an affine payload through its typed domain grant and return H. Canonical staged grants retain payload until commit or abort recovery; this helper itself adds no admission result or arbitrary mutation recovery.

template staged source · line 44 · raw

@-World:Type -> @-P:Type -> @owner:Frame<World, P> -> @payload:P -> Frame<World, P>

template finished source · line 53 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-Error:Data -> @-Out:Type -> @newest:List<&1, P> -> @output:Out -> @result:0x2a0aaf4f2cb3f416a9b91fd887916a5d/transaction.Returned<0x2a0aaf4f2cb3f416a9b91fd887916a5d/world.World<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat>, Error> -> 0x2a0aaf4f2cb3f416a9b91fd887916a5d/system.Outcome<0x2a0aaf4f2cb3f416a9b91fd887916a5d/world.World<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat>, Unit, Reply<Error, Out, P>>

Only available independently staged owners are recovered, after ECS rollback.

template returned source · line 57 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-Error:Data -> @-Out:Type -> @result:Pair(Frame<0x2a0aaf4f2cb3f416a9b91fd887916a5d/world.World<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat>, P>, Pair(0x2a0aaf4f2cb3f416a9b91fd887916a5d/transaction.Outcome<Error>, Out)) -> 0x2a0aaf4f2cb3f416a9b91fd887916a5d/system.Outcome<0x2a0aaf4f2cb3f416a9b91fd887916a5d/world.World<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat>, Unit, Reply<Error, Out, P>>

template runner source · line 63 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-identity:Domain<S, P> -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-body:(@-H:Type -> @-grant:Write<S, P, identity, H> -> @_:Args -> @_:H -> Pair(H, Pair(0x2a0aaf4f2cb3f416a9b91fd887916a5d/transaction.Outcome<Error>, Out))) -> @world:0x2a0aaf4f2cb3f416a9b91fd887916a5d/world.World<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat> -> @args:Args -> 0x2a0aaf4f2cb3f416a9b91fd887916a5d/system.Outcome<0x2a0aaf4f2cb3f416a9b91fd887916a5d/world.World<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat>, Unit, Reply<Error, Out, P>>

Advanced single-domain publisher body with opaque staged-owner grant. Runs once, including an empty World. Body failure rolls back recorded ECS changes and recovers separately staged payloads, not arbitrary consumed data.

template Registry source · line 67 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-identity:Domain<S, P> -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-body:(@-H:Type -> @-grant:Write<S, P, identity, H> -> @_:Args -> @_:H -> Pair(H, Pair(0x2a0aaf4f2cb3f416a9b91fd887916a5d/transaction.Outcome<Error>, Out))) -> Type

Advanced closed publisher registration type. Runtime namespace/live metadata checks still occur through run; this alias owns no registration.

template define source · line 71 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-identity:Domain<S, P> -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-body:(@-H:Type -> @-grant:Write<S, P, identity, H> -> @_:Args -> @_:H -> Pair(H, Pair(0x2a0aaf4f2cb3f416a9b91fd887916a5d/transaction.Outcome<Error>, Out))) -> @world:0x2a0aaf4f2cb3f416a9b91fd887916a5d/world.World<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat> -> @name:String -> 0x2a0aaf4f2cb3f416a9b91fd887916a5d/system.RegistrationResult<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat, Args, Unit, Reply<Error, Out, P>, runner(S, C, R, P, identity, Args, Error, Out, body)>

Register the single-domain publisher with declaration-derived write metadata. Retains World on registration failure and invokes no body here.

template run source · line 77 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-P:Type -> @-identity:Domain<S, P> -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-body:(@-H:Type -> @-grant:Write<S, P, identity, H> -> @_:Args -> @_:H -> Pair(H, Pair(0x2a0aaf4f2cb3f416a9b91fd887916a5d/transaction.Outcome<Error>, Out))) -> @registry:0x2a0aaf4f2cb3f416a9b91fd887916a5d/system.Registry<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat, Args, Unit, Reply<Error, Out, P>, runner(S, C, R, P, identity, Args, Error, Out, body)> -> @world:0x2a0aaf4f2cb3f416a9b91fd887916a5d/world.World<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat> -> @args:Args -> 0x2a0aaf4f2cb3f416a9b91fd887916a5d/system.RunResult<S, C, 0x2a0aaf4f2cb3f416a9b91fd887916a5d/owned_event_storage.Resources<R, P>, Nat, Args, Unit, Reply<Error, Out, P>, runner(S, C, R, P, identity, Args, Error, Out, body)>

Run the checked single-domain publisher. Admission refusal returns original Args/Registry/World; completed execution returns outer Succeeded with Reply carrying the actual body outcome and available staged payload recovery. This distinguishes safe recovery from an outer failure that discards Out.