~/bend-docscommunity

ordinary_owned_event_family_publisher.bend checks

raw source on the hub · import bendvy-ecs-core@0.1.0.7/ordinary_owned_event_family_publisher.bend as Ordinary_owned_event_family_publisher

7 imports
import Base
import ./trace_facts.bend as Facts
import ./world.bend as W
import ./system.bend as Sys
import ./transaction.bend as T
import ./owned_event_journal.bend as Journal
import ./ordinary_owned_event_declaration.bend as D

Types

type Reply source · line 13 · raw

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

Standalone publisher runs once, including worlds without entities. Actual log owners enter the world only after success; failure returns the typed receipt. Publication decision with retained body Out and typed recovery owners. Body Failure is inside Reply, not an outer System.Failed that would discard Out/recovery. Commit/abort follows the canonical staged journal contract.

Templates

template finished source · line 15 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Recovery:Type -> @-Error:Data -> @-Out:Type -> @outcome:0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error> -> @output:Out -> @result:Pair(0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery) -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Unit, Reply<Error, Out, Recovery>>

template returned source · line 18 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Recovery:Type -> @-Error:Data -> @-Out:Type -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @recovery:Recovery -> @result:Pair(0x7e321819d0ff210531780719c7674cef/owned_event_journal.Stage<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery>, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out)) -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Unit, Reply<Error, Out, Recovery>>

template runner source · line 26 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-builder:0x7e321819d0ff210531780719c7674cef/ordinary_owned_event_declaration.Builder(0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery, Ops) -> @-declaration:0x7e321819d0ff210531780719c7674cef/ordinary_owned_event_declaration.Declaration<S, 0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery, Ops, builder> -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-body:(@-J:Type -> @-caps:Ops(J) -> @_:Args -> @_:J -> Pair(J, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out))) -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @args:Args -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Unit, Reply<Error, Out, Recovery>>

Advanced standalone staged publisher: invokes the opaque body once even with no entities. Success commits staged log owners; failure returns typed recovery for staged publication. No payload copying or arbitrary host-effect rollback is provided. Use define/run for registration validation.

template Registry source · line 30 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-builder:0x7e321819d0ff210531780719c7674cef/ordinary_owned_event_declaration.Builder(0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery, Ops) -> @-declaration:0x7e321819d0ff210531780719c7674cef/ordinary_owned_event_declaration.Declaration<S, 0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery, Ops, builder> -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-body:(@-J:Type -> @-caps:Ops(J) -> @_:Args -> @_:J -> Pair(J, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out))) -> Type

Advanced type alias for the publisher's actual closed runner registration. Keep it with its matching World; raw construction is trusted administration.

template define source · line 34 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-builder:0x7e321819d0ff210531780719c7674cef/ordinary_owned_event_declaration.Builder(0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery, Ops) -> @-declaration:0x7e321819d0ff210531780719c7674cef/ordinary_owned_event_declaration.Declaration<S, 0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery, Ops, builder> -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-body:(@-J:Type -> @-caps:Ops(J) -> @_:Args -> @_:J -> Pair(J, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out))) -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @name:String -> 0x7e321819d0ff210531780719c7674cef/system.RegistrationResult<S, C, R, E, Args, Unit, Reply<Error, Out, Recovery>, runner(S, C, R, E, Recovery, Ops, builder, declaration, Args, Error, Out, body)>

Register a staged publisher with access from its owned-event declaration. Returns System registration result retaining World on refusal. Does not execute body or publish events while registering.

template run source · line 41 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-builder:0x7e321819d0ff210531780719c7674cef/ordinary_owned_event_declaration.Builder(0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery, Ops) -> @-declaration:0x7e321819d0ff210531780719c7674cef/ordinary_owned_event_declaration.Declaration<S, 0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery, Ops, builder> -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-body:(@-J:Type -> @-caps:Ops(J) -> @_:Args -> @_:J -> Pair(J, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out))) -> @registry:0x7e321819d0ff210531780719c7674cef/system.Registry<S, C, R, E, Args, Unit, Reply<Error, Out, Recovery>, runner(S, C, R, E, Recovery, Ops, builder, declaration, Args, Error, Out, body)> -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @args:Args -> 0x7e321819d0ff210531780719c7674cef/system.RunResult<S, C, R, E, Args, Unit, Reply<Error, Out, Recovery>, runner(S, C, R, E, Recovery, Ops, builder, declaration, Args, Error, Out, body)>

Validate the publisher registration, then execute its staged body. Admission refusal returns original Args/Registry/World. Completion is outer Succeeded with Reply containing actual publication outcome, Out and typed recovery; inspect Reply.outcome rather than assuming publication succeeded. Publication contract: docs/parity/affine-events.md.

template finished_observed source · line 44 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Recovery:Type -> @-Error:Data -> @-Out:Type -> @outcome:0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error> -> @output:Out -> @result:Pair(Pair(0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery), 0x7e321819d0ff210531780719c7674cef/trace_facts.State) -> Pair(0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Unit, Reply<Error, Out, Recovery>>, 0x7e321819d0ff210531780719c7674cef/trace_facts.State)

template returned_observed source · line 47 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Recovery:Type -> @-Error:Data -> @-Out:Type -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @recovery:Recovery -> @result:Pair(0x7e321819d0ff210531780719c7674cef/owned_event_journal.Stage<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery>, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out)) -> Pair(0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Unit, Reply<Error, Out, Recovery>>, 0x7e321819d0ff210531780719c7674cef/trace_facts.State)

template runner_observed source · line 54 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-builder:0x7e321819d0ff210531780719c7674cef/ordinary_owned_event_declaration.Builder(0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery, Ops) -> @-declaration:0x7e321819d0ff210531780719c7674cef/ordinary_owned_event_declaration.Declaration<S, 0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Recovery, Ops, builder> -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-body:(@-J:Type -> @-caps:Ops(J) -> @_:Args -> @_:J -> Pair(J, Pair(0x7e321819d0ff210531780719c7674cef/transaction.Outcome<Error>, Out))) -> @trace:0x7e321819d0ff210531780719c7674cef/trace_facts.State -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @args:Args -> Pair(0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Unit, Reply<Error, Out, Recovery>>, 0x7e321819d0ff210531780719c7674cef/trace_facts.State)

Advanced traced adapter for the same publisher body and typed recovery. Returns the actual outcome with settled journal facts; observation does not commit additional payloads or change failure recovery semantics.