~/bend-docscommunity

ordinary_recovery_declaration.bend checks

raw source on the hub · import bendvy-ecs-core@0.1.0.2/ordinary_recovery_declaration.bend as Ordinary_recovery_declaration

5 imports
import Base
import ./recovery_use.bend as Use
import ./owner_product.bend as Product
import ./capabilities.bend as Cap
import ./ordinary_recoverable_array_resource.bend as Frame

Types

type Declaration source · line 23 · raw

@-S:Data -> @-State:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-builder:Builder(State, Recovery, Ops) -> Type

Static recovery description for State, recovery owner and operation family Ops. Canonical component/resource/capture modules supply matching builders, empty recovery constructors and typed use descriptions. Arbitrary affine Type payloads are supported by those operations; this is not automatic rollback for all functions, external IO or arbitrary payload mutation. The classic Declaration form has opaque use metadata. Automatic App recovery registration requires a complete description and refuses that opaque form; the classic runner remains available. See docs/parity/recovery.md for the accepted operation domains, owner-return rules and qualified scenarios.

Templates

template Builder source · line 12 · raw

@-State:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> Type

Builder is an erased type index, like a Registry runner. It is specialized at the closed recovery product before any executable grant is materialized. Advanced erased grant-builder type for canonical recovery declarations. Specializes operations to the closed recovery product and an owner-preserving lens into that product. Ordinary bodies receive the generated Ops; they do not supply runtime journal routes or inverse callbacks themselves.

template empty source · line 29 · raw

@-S:Data -> @-State:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-builder:Builder(State, Recovery, Ops) -> @value:Declaration<S, State, Recovery, Ops, builder> -> @_:Unit -> Recovery

Consume a declaration and obtain its fresh recovery-owner constructor. This constructs the accumulator used when a recovery runner finishes; it does not execute operations, undo a transaction or copy live affine recovery values.

template access source · line 36 · raw

@-S:Data -> @-State:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-builder:Builder(State, Recovery, Ops) -> @value:Declaration<S, State, Recovery, Ops, builder> -> List<&2, String>

Consume a declaration and obtain its declared registration access names. Order and duplicates are retained. These strings are metadata, not a journal route or a replacement for the declaration's typed operation authority.

template description source · line 44 · raw

@-S:Data -> @-State:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-builder:Builder(State, Recovery, Ops) -> @value:Declaration<S, State, Recovery, Ops, builder> -> 0xb2b0f04555daca474f0f77d0966945c9/recovery_use.Description

Consume a declaration and return typed operational-use metadata. Legacy Declaration returns an opaque description; Described returns its stored description. Automatic App registration uses completeness rather than parsing access strings. This projection does not validate an inverse or run recovery.

template PairOps source · line 51 · raw

@-L:(@_:Type -> Type) -> @-R:(@_:Type -> Type) -> @H:Type -> Type

Operation-family alias for a bundle of left and right recovery grants acting on the same opaque frame. Keep their order consistent with the paired recovery product constructed by both.

template pair_empty source · line 52 · raw

@-L:Type -> @-R:Type -> @-left:(@_:Unit -> L) -> @-right:(@_:Unit -> R) -> @unit:Unit -> 0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<L, R>

template pair_grant source · line 53 · raw

@-S:Data -> @-State:Type -> @-L:Type -> @-R:Type -> @-LOps:(@_:Type -> Type) -> @-ROps:(@_:Type -> Type) -> @-left:Builder(State, L, LOps) -> @-right:Builder(State, R, ROps) -> @-All:Type -> @-Rest:Type -> @-path:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<All, 0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<L, R>, Rest> -> @unit:Unit -> 0xb2b0f04555daca474f0f77d0966945c9/capabilities.Bundle<LOps(0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Frame<State, All>), ROps(0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Frame<State, All>)>

template both source · line 66 · raw

@-S:Data -> @-State:Type -> @-L:Type -> @-R:Type -> @-LOps:(@_:Type -> Type) -> @-ROps:(@_:Type -> Type) -> @-leftBuilder:Builder(State, L, LOps) -> @-rightBuilder:Builder(State, R, ROps) -> @-left:Declaration<S, State, L, LOps, leftBuilder> -> @-right:Declaration<S, State, R, ROps, rightBuilder> -> Declaration<S, State, 0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<L, R>, PairOps(LOps, ROps), pair_grant(S, State, L, R, LOps, ROps, leftBuilder, rightBuilder)>

Compose two closed declarations for the same schema and State. The body receives Cap.Bundle{left, right}; recovery owners form Product.Owner<LeftRecovery, RightRecovery>. Access entries and typed use lists are appended left first, preserving duplicates; opacity in either description remains opaque. This does not execute either operation or create two journals. The recovery runner uses one shared LIFO journal across both grants: commit returns displaced originals, rollback restores recorded state and returns replacements. Effects outside the declared operations are not made reversible. Canonical leaves: ordinary-recovery-component.declaration, ordinary-recovery-resource.declaration and ordinary-recovery-capture.declaration; ordinary-recovery-system registers/runs the resulting declaration.

template identity_take source · line 68 · raw

@-R:Type -> @value:R -> Pair(Unit, R)

template identity_put source · line 69 · raw

@-R:Type -> @unit:Unit -> @value:R -> R

template identity source · line 72 · raw

@-R:Type -> 0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<R, R, Unit>

Advanced builder lens selecting the complete recovery owner, with Unit rest. It threads that owner once; it does not clone it or establish rollback by itself.

template root_grant source · line 77 · raw

@-S:Data -> @-State:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-builder:Builder(State, Recovery, Ops) -> Ops(0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Frame<State, Recovery>)

Advanced runner projection: instantiate the matching builder at the complete recovery owner with its identity lens. Returns operations, not live state; registration, journal execution and recovery results belong to ordinary-recovery-system. Use canonical declaration constructors for gameplay.