restore_public.bend checks
raw source on the hub · import bendvy-ecs-core@0.1.0.7/restore_public.bend as Restore_public
9 imports
import Base import ./change_tick.bend as Tick import ./restore_data.bend as R import ./restore_schema.bend as Schema import ./restore_prepare.bend as Prepare import ./restore_apply.bend as Apply import ./world.bend as W import ./snapshot_data.bend as Snapshot import ./decode_data.bend as D
Types
type Outcome source · line 38 · raw
@S:Data -> @Custom:Data -> Data
Detached owned-run result. Restored carries full saved-key/actual-handle bindings; RestoreRejected carries the rejected typed input and its structured error. Actual affine recovery is returned separately, never hidden in this Data result.
Restored@S:Data -> @Custom:Data -> @bindings:List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Binding<S>> -> Outcome<S, Custom>
RestoreRejected@S:Data -> @Custom:Data -> @input:0x7e321819d0ff210531780719c7674cef/snapshot_data.Snapshot -> @error:0x7e321819d0ff210531780719c7674cef/restore_data.Error<Custom> -> Outcome<S, Custom>
type Owner source · line 44 · raw
@-S:Data -> @-C:Type -> @-Resources:Type -> @-State:Type -> @-Custom:Data -> @-stage:(@_:State -> @_:0x7e321819d0ff210531780719c7674cef/restore_data.Position -> @_:0x7e321819d0ff210531780719c7674cef/decode_data.Field -> Pair(State, 0x7e321819d0ff210531780719c7674cef/restore_data.Dispatch<Custom>)) -> @-release:(@_:State -> State) -> @-clear:(@_:C -> @_:0x7e321819d0ff210531780719c7674cef/world.Handle<S> -> Pair(C, List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Change<S>>)) -> @-insert:(@_:C -> @_:Resources -> @_:State -> @_:List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Binding<S>> -> @_:0x7e321819d0ff210531780719c7674cef/change_tick.Tick -> Pair(Pair(C, Resources), State)) -> @-Recovery:Type -> @-commit:(@_:State -> State) -> @-takeRecovery:(@_:State -> Pair(State, Recovery)) -> Type
Affine restore context retaining the schema and actual constructor State across calls. Its stage/release/clear/insert/commit/recovery functions are schema-bound advanced adapters, not gameplay access to an arbitrary World or cloned payloads.
Owner@-S:Data -> @-C:Type -> @-Resources:Type -> @-State:Type -> @-Custom:Data -> @-stage:(@_:State -> @_:0x7e321819d0ff210531780719c7674cef/restore_data.Position -> @_:0x7e321819d0ff210531780719c7674cef/decode_data.Field -> Pair(State, 0x7e321819d0ff210531780719c7674cef/restore_data.Dispatch<Custom>)) -> @-release:(@_:State -> State) -> @-clear:(@_:C -> @_:0x7e321819d0ff210531780719c7674cef/world.Handle<S> -> Pair(C, List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Change<S>>)) -> @-insert:(@_:C -> @_:Resources -> @_:State -> @_:List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Binding<S>> -> @_:0x7e321819d0ff210531780719c7674cef/change_tick.Tick -> Pair(Pair(C, Resources), State)) -> @-Recovery:Type -> @-commit:(@_:State -> State) -> @-takeRecovery:(@_:State -> Pair(State, Recovery)) -> @schema:0x7e321819d0ff210531780719c7674cef/restore_schema.Schema<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery> -> @state:State -> Owner<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery>
Templates
template prepare source · line 17 · raw
@-S:Data -> @-C:Type -> @-Resources:Type -> @-E:Data -> @-State:Type -> @-Custom:Data -> @-stage:(@_:State -> @_:0x7e321819d0ff210531780719c7674cef/restore_data.Position -> @_:0x7e321819d0ff210531780719c7674cef/decode_data.Field -> Pair(State, 0x7e321819d0ff210531780719c7674cef/restore_data.Dispatch<Custom>)) -> @-release:(@_:State -> State) -> @-clear:(@_:C -> @_:0x7e321819d0ff210531780719c7674cef/world.Handle<S> -> Pair(C, List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Change<S>>)) -> @-insert:(@_:C -> @_:Resources -> @_:State -> @_:List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Binding<S>> -> @_:0x7e321819d0ff210531780719c7674cef/change_tick.Tick -> Pair(Pair(C, Resources), State)) -> @-Recovery:Type -> @-commit:(@_:State -> State) -> @-takeRecovery:(@_:State -> Pair(State, Recovery)) -> @schema:0x7e321819d0ff210531780719c7674cef/restore_schema.Schema<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery> -> @state:State -> @input:0x7e321819d0ff210531780719c7674cef/snapshot_data.Snapshot -> 0x7e321819d0ff210531780719c7674cef/restore_data.Prepared<State, Custom>
Validate and stage a typed snapshot using the retained schema, without a World argument or live-world mutation. Check version, nextEntity bounds, duplicate saved keys, and schema field dispatch/construction before returning Ready or Refused. Refusal retains the input and staging State; staged owners are released through the schema adapter where preparation stops. This is typed input, not Raw parsing. Use schema-derived codecs/factories; arbitrary adapter behavior is trusted setup.
template apply source · line 27 · raw
@-S:Data -> @-C:Type -> @-Resources:Type -> @-E:Data -> @-State:Type -> @-Custom:Data -> @-stage:(@_:State -> @_:0x7e321819d0ff210531780719c7674cef/restore_data.Position -> @_:0x7e321819d0ff210531780719c7674cef/decode_data.Field -> Pair(State, 0x7e321819d0ff210531780719c7674cef/restore_data.Dispatch<Custom>)) -> @-release:(@_:State -> State) -> @-clear:(@_:C -> @_:0x7e321819d0ff210531780719c7674cef/world.Handle<S> -> Pair(C, List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Change<S>>)) -> @-insert:(@_:C -> @_:Resources -> @_:State -> @_:List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Binding<S>> -> @_:0x7e321819d0ff210531780719c7674cef/change_tick.Tick -> Pair(Pair(C, Resources), State)) -> @-Recovery:Type -> @-commit:(@_:State -> State) -> @-takeRecovery:(@_:State -> Pair(State, Recovery)) -> @-emit:(@_:0x7e321819d0ff210531780719c7674cef/restore_data.Change<S> -> E) -> @schema:0x7e321819d0ff210531780719c7674cef/restore_schema.Schema<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery> -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, Resources, E> -> @prepared:0x7e321819d0ff210531780719c7674cef/restore_data.Prepared<State, Custom> -> 0x7e321819d0ff210531780719c7674cef/restore_apply.ApplyResult<S, C, Resources, E, State, Custom>
Apply a prepared restore to the supplied World, returning Applied or Refused with the World and staging State. A preparation refusal returns World untouched; capacity admission precedes cleanup. Successful application cleans current live entities, allocates fresh target handles and inserts staged fields, returning saved-key-to-handle bindings rather than reusing saved keys as live identities. The emit adapter maps ordinary cleanup/spawn changes into E. This basic wrapper does not reset a complete App Runtime or reconstruct omitted runtime owners; use the runtime restore adapter when its stream/pending-work boundary is needed.
template restore source · line 33 · raw
@-S:Data -> @-C:Type -> @-Resources:Type -> @-E:Data -> @-State:Type -> @-Custom:Data -> @-stage:(@_:State -> @_:0x7e321819d0ff210531780719c7674cef/restore_data.Position -> @_:0x7e321819d0ff210531780719c7674cef/decode_data.Field -> Pair(State, 0x7e321819d0ff210531780719c7674cef/restore_data.Dispatch<Custom>)) -> @-release:(@_:State -> State) -> @-clear:(@_:C -> @_:0x7e321819d0ff210531780719c7674cef/world.Handle<S> -> Pair(C, List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Change<S>>)) -> @-insert:(@_:C -> @_:Resources -> @_:State -> @_:List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Binding<S>> -> @_:0x7e321819d0ff210531780719c7674cef/change_tick.Tick -> Pair(Pair(C, Resources), State)) -> @-Recovery:Type -> @-commit:(@_:State -> State) -> @-takeRecovery:(@_:State -> Pair(State, Recovery)) -> @-emit:(@_:0x7e321819d0ff210531780719c7674cef/restore_data.Change<S> -> E) -> @+schema:0x7e321819d0ff210531780719c7674cef/restore_schema.Schema<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery> -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, Resources, E> -> @state:State -> @input:0x7e321819d0ff210531780719c7674cef/snapshot_data.Snapshot -> 0x7e321819d0ff210531780719c7674cef/restore_apply.ApplyResult<S, C, Resources, E, State, Custom>
Convenience prepare-then-apply on the same schema and staging State. Complete input preparation precedes application; returned State remains an owned result. For persistent constructor context and explicit recovery, use owned then run. See docs/parity/restore-basic.md and its ordinary Restore.restore consumer.
template owned source · line 48 · raw
@-S:Data -> @-C:Type -> @-Resources:Type -> @-E:Data -> @-State:Type -> @-Custom:Data -> @-stage:(@_:State -> @_:0x7e321819d0ff210531780719c7674cef/restore_data.Position -> @_:0x7e321819d0ff210531780719c7674cef/decode_data.Field -> Pair(State, 0x7e321819d0ff210531780719c7674cef/restore_data.Dispatch<Custom>)) -> @-release:(@_:State -> State) -> @-clear:(@_:C -> @_:0x7e321819d0ff210531780719c7674cef/world.Handle<S> -> Pair(C, List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Change<S>>)) -> @-insert:(@_:C -> @_:Resources -> @_:State -> @_:List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Binding<S>> -> @_:0x7e321819d0ff210531780719c7674cef/change_tick.Tick -> Pair(Pair(C, Resources), State)) -> @-Recovery:Type -> @-commit:(@_:State -> State) -> @-takeRecovery:(@_:State -> Pair(State, Recovery)) -> @schema:0x7e321819d0ff210531780719c7674cef/restore_schema.Schema<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery> -> @state:State -> Owner<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery>
Retain the supplied schema and actual staging context in a restore Owner. This setup step neither validates a snapshot nor changes a World.
template recovered source · line 50 · raw
@-S:Data -> @-C:Type -> @-Resources:Type -> @-E:Data -> @-State:Type -> @-Custom:Data -> @-stage:(@_:State -> @_:0x7e321819d0ff210531780719c7674cef/restore_data.Position -> @_:0x7e321819d0ff210531780719c7674cef/decode_data.Field -> Pair(State, 0x7e321819d0ff210531780719c7674cef/restore_data.Dispatch<Custom>)) -> @-release:(@_:State -> State) -> @-clear:(@_:C -> @_:0x7e321819d0ff210531780719c7674cef/world.Handle<S> -> Pair(C, List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Change<S>>)) -> @-insert:(@_:C -> @_:Resources -> @_:State -> @_:List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Binding<S>> -> @_:0x7e321819d0ff210531780719c7674cef/change_tick.Tick -> Pair(Pair(C, Resources), State)) -> @-Recovery:Type -> @-commit:(@_:State -> State) -> @-takeRecovery:(@_:State -> Pair(State, Recovery)) -> @schema:0x7e321819d0ff210531780719c7674cef/restore_schema.Schema<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery> -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, Resources, E> -> @outcome:Outcome<S, Custom> -> @observed:Pair(State, Recovery) -> Pair(0x7e321819d0ff210531780719c7674cef/world.World<S, C, Resources, E>, Pair(Owner<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery>, Pair(Outcome<S, Custom>, Recovery)))
template run_returned source · line 53 · raw
@-S:Data -> @-C:Type -> @-Resources:Type -> @-E:Data -> @-State:Type -> @-Custom:Data -> @-stage:(@_:State -> @_:0x7e321819d0ff210531780719c7674cef/restore_data.Position -> @_:0x7e321819d0ff210531780719c7674cef/decode_data.Field -> Pair(State, 0x7e321819d0ff210531780719c7674cef/restore_data.Dispatch<Custom>)) -> @-release:(@_:State -> State) -> @-clear:(@_:C -> @_:0x7e321819d0ff210531780719c7674cef/world.Handle<S> -> Pair(C, List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Change<S>>)) -> @-insert:(@_:C -> @_:Resources -> @_:State -> @_:List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Binding<S>> -> @_:0x7e321819d0ff210531780719c7674cef/change_tick.Tick -> Pair(Pair(C, Resources), State)) -> @-Recovery:Type -> @-commit:(@_:State -> State) -> @-takeRecovery:(@_:State -> Pair(State, Recovery)) -> @schema:0x7e321819d0ff210531780719c7674cef/restore_schema.Schema<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery> -> @result:0x7e321819d0ff210531780719c7674cef/restore_apply.ApplyResult<S, C, Resources, E, State, Custom> -> Pair(0x7e321819d0ff210531780719c7674cef/world.World<S, C, Resources, E>, Pair(Owner<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery>, Pair(Outcome<S, Custom>, Recovery)))
template run source · line 62 · raw
@-S:Data -> @-C:Type -> @-Resources:Type -> @-E:Data -> @-State:Type -> @-Custom:Data -> @-stage:(@_:State -> @_:0x7e321819d0ff210531780719c7674cef/restore_data.Position -> @_:0x7e321819d0ff210531780719c7674cef/decode_data.Field -> Pair(State, 0x7e321819d0ff210531780719c7674cef/restore_data.Dispatch<Custom>)) -> @-release:(@_:State -> State) -> @-clear:(@_:C -> @_:0x7e321819d0ff210531780719c7674cef/world.Handle<S> -> Pair(C, List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Change<S>>)) -> @-insert:(@_:C -> @_:Resources -> @_:State -> @_:List<&2, 0x7e321819d0ff210531780719c7674cef/restore_data.Binding<S>> -> @_:0x7e321819d0ff210531780719c7674cef/change_tick.Tick -> Pair(Pair(C, Resources), State)) -> @-Recovery:Type -> @-commit:(@_:State -> State) -> @-takeRecovery:(@_:State -> Pair(State, Recovery)) -> @-emit:(@_:0x7e321819d0ff210531780719c7674cef/restore_data.Change<S> -> E) -> @owner:Owner<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery> -> @world:0x7e321819d0ff210531780719c7674cef/world.World<S, C, Resources, E> -> @input:0x7e321819d0ff210531780719c7674cef/snapshot_data.Snapshot -> Pair(0x7e321819d0ff210531780719c7674cef/world.World<S, C, Resources, E>, Pair(Owner<S, C, Resources, State, Custom, stage, release, clear, insert, Recovery, commit, takeRecovery>, Pair(Outcome<S, Custom>, Recovery)))
Consume and return the restore Owner with the World, detached Outcome and actual Recovery owner. Success commits staging before taking recovery; refusal releases staging before taking recovery. Follow the concrete schema recovery type: returned inputs are not duplicate copies of payloads installed into the World. No implicit destructor or full Runtime reset is supplied by this operation.
template dispose_recovery source · line 69 · raw
@-Recovery:Type -> @recovery:Recovery -> Unit
Explicit affine receipt disposal; no implicit destructor callback is invented. Consume an unwanted recovery receipt explicitly and return Unit. This drops the owned value; it invokes no user destructor callback and restores nothing into World. Callers needing recovery contents must handle them before disposal.