~/bend-docscommunity

ordinary_service_declaration.bend checks

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

9 imports
import Base
import ./clock_state.bend as Clock
import ./deferred_command.bend as Deferred
import entity_allocator.bend as Alloc
import ./world.bend as W
import ./system.bend as Sys
import ./schedule.bend as Sch
import ./schedule_provision.bend as SP
import ./schema_fragments.bend as Fragment

Types

type Slot source · line 14 · raw

@P:Type -> Type

One operational binding supplies identity, slot ownership, availability and call. No host IO, sharing, cleanup or callback-failure recovery contract is added. Actual service payload ownership: Missing has no P; Ready retains affine P. This is provisioned resource state, not proof that external host IO will succeed.

type Declaration source · line 20 · raw

@-S:Data -> @-R:Type -> @-P:Type -> @-Rest:Type -> @-take:(@_:R -> Pair(Rest, Slot<P>)) -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> Data

Trusted service binding joins id/key with one resource slot lens and P -> P call. The same binding drives requirements, availability and invocation; strings alone do not grant arbitrary host access. take/put/call must thread actual owners.

type Status source · line 24 · raw

@S:Data -> Data

Detached availability observation from the slot: provided means Ready was seen, not that a host operation was tested, completed or made rollback-safe.

type Setup source · line 57 · raw

@S:Data -> @C:Type -> @R:Type -> @E:Data -> @-scan:(@_:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)) -> Data

Detached service inventory with an erased World availability scan. Entries and scan should come from the same operational declarations; raw forgery is trusted.

Templates

template declare source · line 29 · raw

@-S:Data -> @-R:Type -> @-P:Type -> @-Rest:Type -> @-take:(@_:R -> Pair(Rest, Slot<P>)) -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> @id:U32 -> @key:String -> Declaration<S, R, P, Rest, take, put, call>

Retain a service identity with closed operational adapters. Does not install P, validate external availability or register a runner. Caller-authored adapters remain trusted; no sharing/cleanup/host-failure recovery protocol is added.

template requirement source · line 32 · raw

@-S:Data -> @-R:Type -> @-P:Type -> @-Rest:Type -> @-take:(@_:R -> Pair(Rest, Slot<P>)) -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> @value:Declaration<S, R, P, Rest, take, put, call> -> 0x14a72e1c180a5ab1f8a056d43822425c/schedule_provision.Requirement<S>

Derive the service-id requirement from this operational declaration.

template entry source · line 36 · raw

@-S:Data -> @-R:Type -> @-P:Type -> @-Rest:Type -> @-take:(@_:R -> Pair(Rest, Slot<P>)) -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> @value:Declaration<S, R, P, Rest, take, put, call> -> 0x14a72e1c180a5ab1f8a056d43822425c/schema_fragments.Entry<S>

Derive Service schema metadata from the declaration key; not a separate grant.

template key source · line 40 · raw

@-S:Data -> @-R:Type -> @-P:Type -> @-Rest:Type -> @-take:(@_:R -> Pair(Rest, Slot<P>)) -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> @value:Declaration<S, R, P, Rest, take, put, call> -> String

Return the declaration key for metadata, without inspecting or calling P.

template slot_observed source · line 43 · raw

@-S:Data -> @-R:Type -> @-P:Type -> @-Rest:Type -> @-take:(@_:R -> Pair(Rest, Slot<P>)) -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> @declaration:Declaration<S, R, P, Rest, take, put, call> -> @value:Pair(Rest, Slot<P>) -> Pair(R, Status<S>)

template world_restored source · line 47 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @+ns:U32 -> @allocator:0x14a72e1c180a5ab1f8a056d43822425c/entity_allocator.Allocator -> @store:C -> @+events:List<&2, E> -> @pending:List<&1, 0x14a72e1c180a5ab1f8a056d43822425c/deferred_command.Command<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>>> -> @+registrations:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/world.RegistrationMeta> -> @+nextSystem:U32 -> @+clock:0x14a72e1c180a5ab1f8a056d43822425c/clock_state.State -> @value:Pair(R, Status<S>) -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)

template world_observed source · line 52 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-P:Type -> @-Rest:Type -> @-take:(@_:R -> Pair(Rest, Slot<P>)) -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> @declaration:Declaration<S, R, P, Rest, take, put, call> -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)

Advanced availability scan: take and replace the actual slot, returning World with one detached Status. Does not invoke call; trusted lenses must preserve owners.

template single source · line 60 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-P:Type -> @-Rest:Type -> @-take:(@_:R -> Pair(Rest, Slot<P>)) -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> @-declaration:Declaration<S, R, P, Rest, take, put, call> -> Setup<S, C, R, E, world_observed(S, C, R, E, P, Rest, take, put, call, declaration)>

Build one service inventory/availability scan from its retained declaration.

template scan_join source · line 62 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @first:List<&2, Status<S>> -> @second:Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>) -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)

template scan_next source · line 65 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-right:(@_:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)) -> @value:Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>) -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)

template scan_pair source · line 70 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-left:(@_:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)) -> @-right:(@_:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)) -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)

Advanced left-then-right World scan composition, retaining returned World and concatenating statuses in that order. Does not call either service payload.

template append source · line 74 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-left:(@_:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)) -> @-right:(@_:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)) -> @a:Setup<S, C, R, E, left> -> @b:Setup<S, C, R, E, right> -> Setup<S, C, R, E, scan_pair(S, C, R, E, left, right)>

Compose service setup inventories and scans in left-before-right order. Does not validate global identity uniqueness or provide a missing service payload.

template available_next source · line 77 · raw

@-S:Data -> @provided:Bool -> @id:U32 -> @rest:List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/schedule_provision.Requirement<S>> -> List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/schedule_provision.Requirement<S>>

template available source · line 83 · raw

@-S:Data -> @statuses:List<&2, Status<S>> -> List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/schedule_provision.Requirement<S>>

Convert provided statuses to ordered service requirements; absent slots add none. This is a metadata conversion, not a host capability invocation.

template provisioned source · line 87 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @value:Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>) -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/schedule_provision.Requirement<S>>)

template provision source · line 92 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-scan:(@_:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, Status<S>>)) -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, List<&2, 0x14a72e1c180a5ab1f8a056d43822425c/schedule_provision.Requirement<S>>)

Advanced preflight adapter deriving currently provided requirements via scan. Returns World; readiness is based on actual slots rather than a second key list.

template slot_called source · line 94 · raw

@-R:Type -> @-P:Type -> @-Rest:Type -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> @value:Pair(Rest, Slot<P>) -> R

template runner source · line 101 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-P:Type -> @-Rest:Type -> @-take:(@_:R -> Pair(Rest, Slot<P>)) -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> @-declaration:Declaration<S, R, P, Rest, take, put, call> -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @_:Unit -> 0x14a72e1c180a5ab1f8a056d43822425c/system.Outcome<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Unit, Unit>

Registered service runner: if Ready, call consumes/returns actual P once and is put back; Missing is a successful no-op here. Schedule preflight is separate. No Tx journal, host exception recovery or rollback of external effects is added.

template define source · line 107 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-P:Type -> @-Rest:Type -> @-take:(@_:R -> Pair(Rest, Slot<P>)) -> @-put:(@_:Rest -> @_:Slot<P> -> R) -> @-call:(@_:P -> P) -> @-declaration:Declaration<S, R, P, Rest, take, put, call> -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @name:String -> 0x14a72e1c180a5ab1f8a056d43822425c/system.RegistrationResult<S, C, R, E, Unit, Unit, Unit, runner(S, C, R, E, P, Rest, take, put, call, declaration)>

Register the declaration-bound runner with its operational key as access metadata. Returns ordinary registration success/refusal with World; does not call the service or itself enforce a schedule availability preflight.