def run
import bendvy-ecs-core@0.1.0.4/restore_runtime.bend as RestoreRuntimeimport Base
import bendvy-ecs-core@0.1.0.4/change_tick.bend as Tick
import bendvy-ecs-core@0.1.0.4/restore_public.bend as Public
import bendvy-ecs-core@0.1.0.4/restore_data.bend as R
import bendvy-ecs-core@0.1.0.4/restore_prepare.bend as Prepare
import bendvy-ecs-core@0.1.0.4/snapshot_data.bend as Snapshot
import bendvy-ecs-core@0.1.0.4/decode_data.bend as D
import bendvy-ecs-core@0.1.0.4/world.bend as W
import bendvy-ecs-core@0.1.0.4/event_family_routing.bend as Route
import bendvy-ecs-core@0.1.0.4/event_family_runtime.bend as Family
import bendvy-ecs-core@0.1.0.4/owned_event_family_catalog.bend as Catalog
import bendvy-ecs-core@0.1.0.4/owner_product.bend as Product
38# Restore typed snapshot through the retained schema Owner and actual family
39# runtime. Complete preparation and capacity admission precede log drain/World
40# cleanup. Early refusal retains runtime and returns no drain receipt; owned
41# constructor recovery and rejected input remain explicit in Public.Outcome.
42# After admission, drain actual affine logs via the complete typed catalog and
43# clear stream/publication state, then apply canonical cleanup/fresh spawning and
44# saved-key-to-handle bindings. Pending closures are dropped without execution and
45# Pending allocator marks abandoned; saved keys are not restored live identities.
46# Return actual restore Owner, constructor recovery and optional drain Receipt with
47# runtime. Success synchronizes restored publications at the next family tick;
48# this is not a full runtime reset: registration/Local/capture/reader owners remain
49# subject to the existing retained-runtime contract. No payload is copied into a
50# detached recovery value or silently disposed by a fabricated host destructor.
51# See docs/parity/restore-basic.md for the complete runtime omissions/boundary.
52def run(~S:Data,~C:Type,~User:Type,~Logs:Type,~E:Data,~F:Type,~EventOwners:Type,~Receipt:Type,~State:Type,~Custom:Data,~stage:State -> R.Position -> D.Field -> State & R.Dispatch<Custom>,~release:State -> State,~clear:C -> W.Handle<S> -> C & List<&2,R.Change<S>>,~insert:C -> Product.Owner<User,Logs> -> State -> List<&2,R.Binding<S>> -> Tick.Tick -> (C & Product.Owner<User,Logs>) & State,~emit:R.Change<S> -> E,~retain:Logs -> List<&2,E> -> Logs & Receipt,~drain:Logs -> Logs & Receipt,~clearStreams:F -> F,~catalog:Catalog.Catalog<E,Logs,F,Receipt,retain,drain,clearStreams>,~sync:F -> Nat -> List<&2,E> -> F,~Recovery:Type,~commit:State -> State,~takeRecovery:State -> State & Recovery,owner:Public.Owner<S,C,Product.Owner<User,Logs>,State,Custom,stage,release,clear,insert,Recovery,commit,takeRecovery>,runtime:Route.Runtime<S,C,Product.Owner<User,Logs>,E,Family.State<E,F,EventOwners>>,input:Snapshot.Snapshot) -> Route.Runtime<S,C,Product.Owner<User,Logs>,E,Family.State<E,F,EventOwners>> & (Public.Owner<S,C,Product.Owner<User,Logs>,State,Custom,stage,release,clear,insert,Recovery,commit,takeRecovery> & (Public.Outcome<S,Custom> & (Recovery & Maybe<&1,Receipt>))):
53 match owner:
54 case Public.Owner{schema,state}:prepared(~S,~C,~User,~Logs,~E,~F,~EventOwners,~Receipt,~State,~Custom,~stage,~release,~clear,~insert,~emit,~retain,~drain,~clearStreams,~catalog,~sync,~Recovery,~commit,~takeRecovery,schema,runtime,Prepare.prepare(~State,~Custom,~stage,~release,state,input))
Uses (20)
Used by (0)
No other definition uses this definition.