execution_relation_schema_setup.bend

bendvy-ecs-core@0.1.0.3 · 17 lines · 3 definitions

1import Base
2import bendvy-ecs-core@0.1.0.3/world.bend as W
3import bendvy-ecs-core@0.1.0.3/execution_composer_layout.bend as Layout
4import bendvy-ecs-core@0.1.0.3/execution_composer_schema.bend as Schema
5import bendvy-ecs-core@0.1.0.3/execution_relation_context.bend as Context
6import bendvy-ecs-core@0.1.0.3/execution_schema_provisioning.bend as Provision
7
8# Trusted schema setup receives only the next namespace of the consumed actual
9# Factory and an affine seed. It cannot inspect or mutate a running World.
10# Schema rejection returns every constructed resource through Initialization.
11def create(~S:Data,~components:Layout.Layout,~resources:Layout.Layout,~E:Data,~Seed:Type,~build:U32 -> Seed -> Layout.resources(~S,resources),factory:W.Factory,seed:Seed) -> Context.Initialization<S,components,resources,E>:
12  match factory:
13    case W.Factory{+nextNamespace}:Context.from_schema(~S,~components,~resources,~E,Schema.create(~S,~components,~resources,~E,W.Factory{nextNamespace},build(nextNamespace,seed)))
14type ProvisionedInitialization<-S:Data,-components:Layout.Layout,-resources:Layout.Layout,-E:Data,-Seed:Type,-blueprint:Provision.Blueprint<S,resources,Seed>> is Type:
15  ProvisionedInitialization{result:Context.Initialization<S,components,resources,E>}
16def create_provisioned(~S:Data,~components:Layout.Layout,~resources:Layout.Layout,~E:Data,~Seed:Type,~blueprint:Provision.Blueprint<S,resources,Seed>,factory:W.Factory,seed:Seed) -> ProvisionedInitialization<S,components,resources,E,Seed,blueprint>:
17  ProvisionedInitialization{create(~S,~components,~resources,~E,~Seed,~Provision.builder(~S,~resources,~Seed,blueprint),factory,seed)}