~/bend-docscommunity

ordinary_event_declaration.bend checks

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

4 imports
import Base
import ./world.bend as W
import ./system.bend as Sys
import ./event_runtime.bend as Ev

Types

type Domain source · line 11 · raw

@S:Data -> @E:Data -> Data

The ordinary typed event domain is supplied once to grants and registration. Schema-scoped name for one Data event stream. Owns no stream, payload or cursor; use the same declaration for typed grants and registration. For affine Type events use the owned-event APIs, not this Data-only domain. Full typed-family contract: docs/parity/typed-data-events.md.

type Mode source · line 15 · raw

Data

Requested event access: Read observes a stream; Write publishes to it. A write declaration does not implicitly confer read access.

type Declaration source · line 20 · raw

@S:Data -> @E:Data -> Data

Event domain and requested read/write mode used for registration metadata. This Data declaration owns no reader and does not itself publish or retain events.

Templates

template domain source · line 26 · raw

@-S:Data -> @-E:Data -> @key:String -> Domain<S, E>

Name a Data event domain in schema S. Does not create storage, register a reader or validate collisions; typed family setup supplies stream routing. Example: Event.write(~S,~E,Event.domain(~S,~E,"hit")); see test-fixtures/connected-performance/failedtxn-health64/consumer/health-access.bend.

template read source · line 29 · raw

@-S:Data -> @-E:Data -> @domain:Domain<S, E> -> Declaration<S, E>

Declare read access to this Data stream without allocating a cursor. Register a reader to obtain independent visibility and retention ownership.

template write source · line 32 · raw

@-S:Data -> @-E:Data -> @domain:Domain<S, E> -> Declaration<S, E>

Declare publication access to this Data stream without publishing an event. Visibility and rollback follow the enclosing publication/transaction path.

template access source · line 35 · raw

@-S:Data -> @-E:Data -> @declaration:Declaration<S, E> -> String

Return the domain key suffixed with :read or :write for registration metadata. This string does not grant access or identify an actual runtime world.

template reading source · line 42 · raw

@-S:Data -> @-E:Data -> @-H:Type -> @-observe:(@_:H -> Pair(H, 0x7e321819d0ff210531780719c7674cef/event_runtime.Reading<E>)) -> @declaration:Declaration<S, E> -> Maybe<&2, 0x7e321819d0ff210531780719c7674cef/event_runtime.ReadAccess<H, E, observe>>

Select a typed read grant: Some only for Read, None for Write. observe is trusted owner-threading setup; constructing a grant invokes no reader and does not advance a cursor or inspect a stream.

template publishing source · line 49 · raw

@-S:Data -> @-E:Data -> @-H:Type -> @-publish:(@_:H -> @_:E -> H) -> @declaration:Declaration<S, E> -> Maybe<&2, 0x7e321819d0ff210531780719c7674cef/event_runtime.WriteAccess<H, E, publish>>

Select a typed publication grant: Some only for Write, None for Read. publish is a trusted owner-threading operation; the declaration does not make arbitrary callback effects transactional or execute publication here.

template register_reader source · line 57 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-A:Type -> @-Error:Data -> @-O:Type -> @-runner:(@_:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @_:0x7e321819d0ff210531780719c7674cef/event_runtime.Input<E, A> -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error, O>) -> @runtime:0x7e321819d0ff210531780719c7674cef/event_runtime.Runtime<S, C, R, E> -> @+declaration:Declaration<S, E> -> @name:String -> 0x7e321819d0ff210531780719c7674cef/event_runtime.Registered<S, C, R, E, A, Error, O, runner>

Register a reader with declaration-derived access metadata and an independent stream cursor. A Write declaration returns RegisterFailed with runtime retained; ordinary registration refusal also retains runtime. Success returns runtime, reader and registry owners; no body executes while registering.

template register_writer source · line 64 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-A:Type -> @-Error:Data -> @-O:Type -> @-runner:(@_:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @_:A -> 0x7e321819d0ff210531780719c7674cef/system.Outcome<0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E>, Error, O>) -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, R, E> -> @+declaration:Declaration<S, E> -> @name:String -> 0x7e321819d0ff210531780719c7674cef/system.RegistrationResult<S, C, R, E, A, Error, O, runner>

Register a publishing system using declaration-derived access metadata. A Read declaration returns RegistrationFailed with world retained; successful registration returns the world and registry. No event is sent by registration.

template read_grant source · line 72 · raw

@-S:Data -> @-E:Data -> @-H:Type -> @-observe:(@_:H -> Pair(H, 0x7e321819d0ff210531780719c7674cef/event_runtime.Reading<E>)) -> @_:Domain<S, E> -> 0x7e321819d0ff210531780719c7674cef/event_runtime.ReadAccess<H, E, observe>

Trusted setup constructor for a closed read operation indexed by observe. Accepts a domain without mode validation; prefer reading when checking a Declaration. Runtime world/reader checks belong to the supplied operation.

template write_grant source · line 76 · raw

@-S:Data -> @-E:Data -> @-H:Type -> @-publish:(@_:H -> @_:E -> H) -> @_:Domain<S, E> -> 0x7e321819d0ff210531780719c7674cef/event_runtime.WriteAccess<H, E, publish>

Trusted setup constructor for a closed publication operation indexed by publish. Accepts a domain without checking a Declaration mode. Runtime authority and rollback are properties of the supplied operation, not this token.