ordinary_app_service_registration.bend
bendvy-ecs-core@0.1.0.4 · 131 lines · 28 definitions
1import Base
2import bendvy-ecs-core@0.1.0.4/ordinary_app_execution_recipe.bend as Exec
3import bendvy-ecs-core@0.1.0.4/ordinary_app_execution_run.bend as ExecuteRun
4import bendvy-ecs-core@0.1.0.4/execution_context.bend as Ctx
5import bendvy-ecs-core@0.1.0.4/trace_facts.bend as Facts
6import bendvy-ecs-core@0.1.0.4/schedule.bend as Sch
7import bendvy-ecs-core@0.1.0.4/captured_schedule_composition.bend as Choice
8import bendvy-ecs-core@0.1.0.4/ordinary_app_composer.bend as Build
9import bendvy-ecs-core@0.1.0.4/ordinary_app_recipe.bend as Tree
10import bendvy-ecs-core@0.1.0.4/ordinary_app_records.bend as Leaf
11import bendvy-ecs-core@0.1.0.4/world.bend as W
12import bendvy-ecs-core@0.1.0.4/system.bend as Sys
13import bendvy-ecs-core@0.1.0.4/schedule_provision.bend as SP
14import bendvy-ecs-core@0.1.0.4/ordinary_service_declaration.bend as D
15import bendvy-ecs-core@0.1.0.4/ordinary_app_registration_fields.bend as Records
16import bendvy-ecs-core@0.1.0.4/ordinary_app_observation_data.bend as DTO
17
18
19
20type Owner<S:Data,C:Type,R:Type,E:Data,Payload:Type,Rest:Type,-take:R -> Rest & D.Slot<Payload>,-put:Rest -> D.Slot<Payload> -> R,-call:Payload -> Payload,-declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,-scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>> is Type:
21 Owner{registry:Sys.Registry<S,C,R,E,Unit,Unit,Unit,D.runner(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration)>,setup:D.Setup<S,C,R,E,scan>}
22
23type View<S:Data> is Data:
24 View{provided:List<&2,D.Status<S>>,required:List<&2,SP.Requirement<S>>}
25
26
27def fields(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,owner:Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>) -> Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan> & List<&2,Records.Fields<S>>:
28 match owner:
29 case Owner{Sys.Registry{+namespace,+id,+name,+access,+cursor},setup}:(Owner{Sys.Registry{namespace,id,name,access,cursor},setup},[Records.Fields{namespace,id,name,access,cursor,D.key(~S,~R,~Payload,~Rest,~take,~put,~call,declaration),[],Records.ServiceKind{}}])
30
31def required(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>) -> SP.Requirement<S>:
32 D.requirement(~S,~R,~Payload,~Rest,~take,~put,~call,declaration)
33def provided_text(~S:Data,value:D.Status<S>) -> String:
34 match value:
35 case D.Status{id,key,ready}:key ++ ":" ++ U32.show(id) ++ ":" ++ Bool.show(ready)
36def requirement_text(~S:Data,value:SP.Requirement<S>) -> String:
37 match value:
38 case SP.Service{id}:"Service:" ++ U32.show(id)
39 case SP.Resource{id}:"Resource:" ++ U32.show(id)
40 case SP.Component{id}:"Component:" ++ U32.show(id)
41def observed(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,result:W.World<S,C,R,E> & List<&2,D.Status<S>>) -> W.World<S,C,R,E> & DTO.Observation<View<S>>:
42 match result:
43 case (world,+provided):(world,DTO.Observation{View{provided,[required(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)]},["services=" ++ List.show(&2,D.Status<S>,provided_text(~S),provided),"requires=" ++ requirement_text(~S,required(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))]})
44
45
46
47def observe(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,world:W.World<S,C,R,E>) -> W.World<S,C,R,E> & DTO.Observation<View<S>>:
48 observed(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,scan(world))
49def dispatched(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,setup:D.Setup<S,C,R,E,scan>,result:Sys.RunResult<S,C,R,E,Unit,Unit,Unit,D.runner(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration)>) -> Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan> & Sys.Outcome<W.World<S,C,R,E>,Unit,Unit>:
50 match result:
51 case Sys.Completed{registry,outcome}:(Owner{registry,setup},outcome)
52 case Sys.RegistrationRejected{registry,world,_}:(Owner{registry,setup},Sys.Failed{world,Unit{}})
53
54
55
56def run(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,owner:Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,world:W.World<S,C,R,E>) -> Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan> & Sys.Outcome<W.World<S,C,R,E>,Unit,Unit>:
57 match owner:
58 case Owner{registry,setup}:dispatched(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,setup,Sys.run(~S,~C,~R,~E,~Unit,~Unit,~Unit,~D.runner(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration),registry,world,Unit{}))
59
60
61def Application(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>) -> Type:
62 Build.Registered<S,W.World<S,C,R,E>,Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,DTO.Product<Rows,View<S>>,Tree.observe_pair(~W.World<S,C,R,E>,~Rows,~View<S>,~prior,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Leaf.fold_pair(~S,~Owners,~Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,~fold,~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))>
63def defined(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~Output:Type,done:Build.Registered<S,W.World<S,C,R,E>,Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,DTO.Product<Rows,View<S>>,Tree.observe_pair(~W.World<S,C,R,E>,~Rows,~View<S>,~prior,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Leaf.fold_pair(~S,~Owners,~Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,~fold,~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))> -> Output,failed:Build.Registered<S,W.World<S,C,R,E>,Owners,Rows,prior,fold> -> Output,setup:D.Setup<S,C,R,E,scan>,owners:Owners,recipe:Tree.Recipe<W.World<S,C,R,E>,Rows,prior>,debug:Bool,result:Sys.RegistrationResult<S,C,R,E,Unit,Unit,Unit,D.runner(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration)>) -> Output:
64 match result:
65 case Sys.RegistrationFailed{world}:failed(Build.Registered{world,owners,recipe,debug})
66 case Sys.Registered{world,registry}:done(Build.appended(~S,~W.World<S,C,R,E>,~Owners,~Rows,~prior,~fold,~Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,~View<S>,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan),~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan),world,owners,Owner{registry,setup},debug))
67
68
69
70def install(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~Output:Type,done:Build.Registered<S,W.World<S,C,R,E>,Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,DTO.Product<Rows,View<S>>,Tree.observe_pair(~W.World<S,C,R,E>,~Rows,~View<S>,~prior,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Leaf.fold_pair(~S,~Owners,~Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,~fold,~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))> -> Output,failed:Build.Registered<S,W.World<S,C,R,E>,Owners,Rows,prior,fold> -> Output,setup:D.Setup<S,C,R,E,scan>,name:String,app:Build.Registered<S,W.World<S,C,R,E>,Owners,Rows,prior,fold>) -> Output:
71 match app:
72 case Build.Registered{world,owners,recipe,debug}:defined(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~Output,done,failed,setup,owners,recipe,debug,D.define(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,world,name))
73
74
75
76def execution_plan(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,owner:Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>) -> Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan> & SP.Plan<S>:
77 match owner:
78 case Owner{Sys.Registry{+namespace,+id,+name,+access,+cursor},setup}:(Owner{Sys.Registry{namespace,id,name,access,cursor},setup},SP.Entry{Sch.System{id,0},[required(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)]})
79def execution_returned(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,trace:Facts.State,result:Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan> & Sys.Outcome<W.World<S,C,R,E>,Unit,Unit>) -> Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan> & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,Unit,Unit>:
80 match result:
81 case (owner,outcome):(owner,ExecuteRun.outcome(~W.World<S,C,R,E>,~Unit,~Unit,trace,outcome))
82def execution_allowed(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,allowed:Bool,owner:Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,context:Ctx.Context<W.World<S,C,R,E>>,id:U32) -> Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan> & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,Unit,Unit>:
83 match allowed context:
84 case False{} context:(owner,Sys.Failed{context,Unit{}})
85 case True{} Ctx.Context{world,trace}:execution_returned(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,trace,run(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,owner,world))
86
87
88
89def execution_run(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,owner:Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,context:Ctx.Context<W.World<S,C,R,E>>,id:U32) -> Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan> & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,Unit,Unit>:
90 match owner:
91 case Owner{Sys.Registry{namespace,+actual,name,access,cursor},setup}:
92 +selected=id
93 execution_allowed(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,U32.is_eq(selected,actual),Owner{Sys.Registry{namespace,actual,name,access,cursor},setup},context,selected)
94
95
96def Executable(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>) -> Type:
97 Exec.Registered<S,W.World<S,C,R,E>,Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,DTO.Product<Rows,View<S>>,Tree.observe_pair(~W.World<S,C,R,E>,~Rows,~View<S>,~prior,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Leaf.fold_pair(~S,~Owners,~Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,~fold,~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Choice.Choice<PriorError,Unit>,Exec.plan_pair(~S,~Owners,~Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,~priorPlan,~execution_plan(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Exec.dispatch_pair(~S,~W.World<S,C,R,E>,~Owners,~Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,~PriorError,~Unit,~fold,~priorDispatch,~execution_run(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Exec.provision_pair(~S,~W.World<S,C,R,E>,~priorProvide,~D.provision(~S,~C,~R,~E,~scan))>
98def execution_added(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Output:Type,done:Executable(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide) -> Output,app:Application(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold)) -> Output:
99 done(Exec.Registered{app,Exec.Recipe{}})
100def execution_rejected(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Output:Type,failed:Exec.Registered<S,W.World<S,C,R,E>,Owners,Rows,prior,fold,PriorError,priorPlan,priorDispatch,priorProvide> -> Output,app:Build.Registered<S,W.World<S,C,R,E>,Owners,Rows,prior,fold>) -> Output:
101 failed(Exec.Registered{app,Exec.Recipe{}})
102
103
104
105def add(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>,~Output:Type,done:Executable(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide) -> Output,failed:Exec.Registered<S,W.World<S,C,R,E>,Owners,Rows,prior,fold,PriorError,priorPlan,priorDispatch,priorProvide> -> Output,setup:D.Setup<S,C,R,E,scan>,name:String,value:Exec.Registered<S,W.World<S,C,R,E>,Owners,Rows,prior,fold,PriorError,priorPlan,priorDispatch,priorProvide>) -> Output:
106 match value:
107 case Exec.Registered{app,_}:install(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~Output,execution_added(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Output,done),execution_rejected(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Output,failed),setup,name,app)
108
109def execution_owners(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>) -> Type:
110 Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>
111
112def execution_rows(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>) -> Data:
113 DTO.Product<Rows,View<S>>
114
115def execution_observe(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>) -> W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<DTO.Product<Rows,View<S>>>:
116 Tree.observe_pair(~W.World<S,C,R,E>,~Rows,~View<S>,~prior,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))
117
118def execution_fold(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>) -> (Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>) -> (Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>) & List<&2,Records.Fields<S>>:
119 Leaf.fold_pair(~S,~Owners,~Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,~fold,~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))
120
121def composed_plan(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>) -> (Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>) -> (Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>) & SP.Plan<S>:
122 Exec.plan_pair(~S,~Owners,~Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,~priorPlan,~execution_plan(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))
123
124
125def execution_dispatch(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>) -> (Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>) -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> (Owners & Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>) & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,Choice.Choice<PriorError,Unit>,Unit>:
126 Exec.dispatch_pair(~S,~W.World<S,C,R,E>,~Owners,~Owner<S,C,R,E,Payload,Rest,take,put,call,declaration,scan>,~PriorError,~Unit,~fold,~priorDispatch,~execution_run(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))
127
128
129
130def execution_provide(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot<Payload>,~put:Rest -> D.Slot<Payload> -> R,~call:Payload -> Payload,~declaration:D.Declaration<S,R,Payload,Rest,take,put,call>,~scan:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,D.Status<S>>,~Owners:Type,~Rows:Data,~prior:W.World<S,C,R,E> -> W.World<S,C,R,E> & DTO.Observation<Rows>,~fold:Owners -> Owners & List<&2,Records.Fields<S>>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan<S>,~priorDispatch:Owners -> Ctx.Context<W.World<S,C,R,E>> -> U32 -> Owners & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,PriorError,Unit>,~priorProvide:W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>) -> W.World<S,C,R,E> -> W.World<S,C,R,E> & List<&2,SP.Requirement<S>>:
131 Exec.provision_pair(~S,~W.World<S,C,R,E>,~priorProvide,~D.provision(~S,~C,~R,~E,~scan))