ordinary_app_event_notice_runtime.bend

bendvy-ecs-core@0.1.0.1 · 30 lines · 0 definitions

1import Base
2import bendvy-ecs-core@0.1.0.1/event_notice_runtime.bend as Mixed
3import bendvy-ecs-core@0.1.0.1/relation_commands.bend as Notice
4import bendvy-ecs-core@0.1.0.1/event_family_routing.bend as Route
5import bendvy-ecs-core@0.1.0.1/ordinary_event_family.bend as Family
6import bendvy-ecs-core@0.1.0.1/ordinary_app_event_family_runtime.bend as App
7import bendvy-ecs-core@0.1.0.1/ordinary_app_schema.bend as SchemaApp
8import bendvy-ecs-core@0.1.0.1/ordinary_app_composer.bend as Build
9import bendvy-ecs-core@0.1.0.1/ordinary_app_recipe.bend as Tree
10import bendvy-ecs-core@0.1.0.1/ordinary_app_registration_fields.bend as Records
11import bendvy-ecs-core@0.1.0.1/ordinary_app_observation_data.bend as DTO
12import bendvy-ecs-core@0.1.0.1/ordinary_schema.bend as Schema
13import bendvy-ecs-core@0.1.0.1/world.bend as W
14
15# Start a mixed typed-event/relation-notice runtime around the sole schema App
16# World. Canonical provision creates typed leaves; actual event owners and separate
17# failure-domain state are retained. This does not register/run a gameplay reader
18# or conflate typed publication ticks with failure-domain timing.
19def start(~S:Data,~C:Type,~R:Type,~P:Data,~D:Data,~F:Type,~H:Type,~make:D -> Nat -> F,~sync:F -> Nat -> List<&2,P> -> F,~frame:F -> Nat -> F,~retain:F -> Nat -> List<&2,P> -> F & List<&2,P>,~inventory:F -> F & List<&2,String>,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,Notice.Notice<S,P>> -> W.World<S,C,R,Notice.Notice<S,P>> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,provision:Family.Provision<S,P,D,F,make,sync,frame,retain,inventory>,events:H,capacity:Nat,value:SchemaApp.Application<S,C,R,Notice.Notice<S,P>,Owners,Rows,observe,fold>) -> App.Application<S,C,R,Notice.Notice<S,P>,Mixed.State<S,P,F,H>,Owners,Rows,observe,fold>:
20  match provision value:
21    case Family.Provision{domains} SchemaApp.Application{schema,Build.Registered{world,owners,recipe,debug}}:App.Application{schema,Mixed.start(~S,~C,~R,~P,~F,~H,world,make(domains,capacity),events),owners,recipe,debug}
22def inventoried(~S:Data,~C:Type,~R:Type,~P:Data,~F:Type,~H:Type,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,Notice.Notice<S,P>> -> W.World<S,C,R,Notice.Notice<S,P>> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,schema:Schema.Schema<S,C,R>,owners:Owners,recipe:Tree.Recipe<W.World<S,C,R,Notice.Notice<S,P>>,Rows,observe>,debug:Bool,returned:Route.Runtime<S,C,R,Notice.Notice<S,P>,Mixed.State<S,P,F,H>> & Maybe<&2,List<&2,String>>) -> App.Application<S,C,R,Notice.Notice<S,P>,Mixed.State<S,P,F,H>,Owners,Rows,observe,fold> & Maybe<&2,List<&2,String>>:
23  match returned:
24    case (runtime,names):(App.Application{schema,runtime,owners,recipe,debug},names)
25# Return App and optional mixed runtime inventory, retaining actual World/family
26# owners. Disabled bypasses inventory derivation; enabled describes typed/failure
27# sources through the supplied trusted adapter, without acknowledgement or dispatch.
28def inventory(~S:Data,~C:Type,~R:Type,~P:Data,~F:Type,~H:Type,~inventory:F -> F & List<&2,String>,~Owners:Type,~Rows:Data,~observe:W.World<S,C,R,Notice.Notice<S,P>> -> W.World<S,C,R,Notice.Notice<S,P>> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,value:App.Application<S,C,R,Notice.Notice<S,P>,Mixed.State<S,P,F,H>,Owners,Rows,observe,fold>) -> App.Application<S,C,R,Notice.Notice<S,P>,Mixed.State<S,P,F,H>,Owners,Rows,observe,fold> & Maybe<&2,List<&2,String>>:
29  match value:
30    case App.Application{schema,runtime,owners,recipe,+debug}:inventoried(~S,~C,~R,~P,~F,~H,~Owners,~Rows,~observe,~fold,schema,owners,recipe,debug,Mixed.inventory_enabled(~S,~C,~R,~P,~F,~H,~inventory,debug,runtime))