~/bend-docscommunity

ordinary_recovery_resource_field.bend checks

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

12 imports
import Base
import ./recovery_use.bend as Use
import ./resource_field_binding.bend as Binding
import ./world.bend as W
import ./owner_product.bend as Product
import ./ordinary_recovery_declaration.bend as D
import ./ordinary_recoverable_array_resource.bend as F
import ./recoverable_array.bend as A
import ./recoverable_array_owner.bend as AO
import ./recovery_journal.bend as Journal
import ./world_resource_owner.bend as WR
import ./ordinary_schema.bend as Schema

Templates

template Ops source · line 17 · raw

@-S:Data -> @-P:Type -> @-identity:0xb2b0f04555daca474f0f77d0966945c9/ordinary_schema.Resource<S, Array<P>> -> @H:Type -> Type

Canonical selected resource field with generated recovery path; no caller inverse. Binding supplies the same identity/path pair as ordinary resource-field grants. Advanced capability-shape projection for identity-indexed recoverable Array<P> replacement and checked element swap, with opaque execution owner H.

template resource_target source · line 20 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> 0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, R, Pair(Capture, 0xb2b0f04555daca474f0f77d0966945c9/world_resource_owner.Rest<S, C, R, E>)>

Trusted recovery lens into World resources while threading actual capture and all other World fields. This is setup plumbing, not a gameplay World accessor.

template target source · line 24 · raw

@-S:Data -> @-C:Type -> @-E:Data -> @-Capture:Type -> @-R:Type -> @-P:Type -> @-FieldRest:Type -> @-fieldLens:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<R, Array<P>, FieldRest> -> 0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, Array<P>, Pair(Pair(Capture, 0xb2b0f04555daca474f0f77d0966945c9/world_resource_owner.Rest<S, C, R, E>), FieldRest)>

Trusted composition of World-resource and selected Array-field lenses. Canonical binding supplies the identity/path pair; siblings/capture stay owned.

template empty source · line 26 · raw

@-Capture:Type -> @-R:Type -> @-P:Type -> @-FieldRest:Type -> @-fieldLens:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<R, Array<P>, FieldRest> -> @unit:Unit -> List<&1, 0xb2b0f04555daca474f0f77d0966945c9/recoverable_array.Record<P>>

template replaced source · line 27 · raw

@-S:Data -> @-C:Type -> @-E:Data -> @-Capture:Type -> @-R:Type -> @-P:Type -> @-FieldRest:Type -> @-fieldLens:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<R, Array<P>, FieldRest> -> @-All:Type -> @-Rest:Type -> @-path:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<All, List<&1, 0xb2b0f04555daca474f0f77d0966945c9/recoverable_array.Record<P>>, Rest> -> @result:Pair(0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, List<&1, 0xb2b0f04555daca474f0f77d0966945c9/recovery_journal.Action(0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, All)>) -> 0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Frame<0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, All>

template replace source · line 34 · raw

@-S:Data -> @-C:Type -> @-E:Data -> @-Capture:Type -> @-R:Type -> @-P:Type -> @-FieldRest:Type -> @-fieldLens:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<R, Array<P>, FieldRest> -> @-All:Type -> @-Rest:Type -> @-path:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<All, List<&1, 0xb2b0f04555daca474f0f77d0966945c9/recoverable_array.Record<P>>, Rest> -> @frame:0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Frame<0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, All> -> @incoming:Array<P> -> 0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Frame<0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, All>

Advanced recoverable replacement: consume incoming Array<P>, install it in the selected field and journal the displaced array in the shared recovery path. Commit returns displaced owners; rollback restores originals and returns displaced replacements through the declaration recovery result, not a duplicate live owner.

template swapped source · line 37 · raw

@-S:Data -> @-C:Type -> @-E:Data -> @-Capture:Type -> @-R:Type -> @-P:Type -> @-FieldRest:Type -> @-fieldLens:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<R, Array<P>, FieldRest> -> @-All:Type -> @-Rest:Type -> @-path:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<All, List<&1, 0xb2b0f04555daca474f0f77d0966945c9/recoverable_array.Record<P>>, Rest> -> @result:0xb2b0f04555daca474f0f77d0966945c9/recoverable_array_owner.Attempt<0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, All, P> -> 0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Attempt<0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Frame<0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, All>, P>

template swap source · line 45 · raw

@-S:Data -> @-C:Type -> @-E:Data -> @-Capture:Type -> @-R:Type -> @-P:Type -> @-FieldRest:Type -> @-fieldLens:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<R, Array<P>, FieldRest> -> @-All:Type -> @-Rest:Type -> @-path:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<All, List<&1, 0xb2b0f04555daca474f0f77d0966945c9/recoverable_array.Record<P>>, Rest> -> @frame:0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Frame<0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, All> -> @index:U32 -> @incoming:P -> 0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Attempt<0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Frame<0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, All>, P>

Advanced bounds-checked element replacement consuming P. Applied journals old P; Refused returns actual incoming P with state/journal preserved when index is out of bounds. Recovery follows shared journal order; unlike raw Array access this does not wrap an invalid index into another slot.

template grant source · line 50 · raw

@-S:Data -> @-C:Type -> @-E:Data -> @-Capture:Type -> @-R:Type -> @-P:Type -> @-FieldRest:Type -> @-fieldLens:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<R, Array<P>, FieldRest> -> @-identity:0xb2b0f04555daca474f0f77d0966945c9/ordinary_schema.Resource<S, Array<P>> -> @-All:Type -> @-Rest:Type -> @-path:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<All, List<&1, 0xb2b0f04555daca474f0f77d0966945c9/recoverable_array.Record<P>>, Rest> -> @unit:Unit -> 0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Write<S, P, identity, 0xb2b0f04555daca474f0f77d0966945c9/ordinary_recoverable_array_resource.Frame<0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, All>>

Advanced canonical grant builder hiding resource lens and journal plumbing behind the identity-indexed recoverable write operations. Does not execute them.

template declaration source · line 57 · raw

@-S:Data -> @-C:Type -> @-E:Data -> @-Capture:Type -> @-R:Type -> @-P:Type -> @-FieldRest:Type -> @-fieldLens:0xb2b0f04555daca474f0f77d0966945c9/owner_product.Lens<R, Array<P>, FieldRest> -> @-identity:0xb2b0f04555daca474f0f77d0966945c9/ordinary_schema.Resource<S, Array<P>> -> @-binding:0xb2b0f04555daca474f0f77d0966945c9/resource_field_binding.Binding<S, R, Array<P>, FieldRest, fieldLens, identity> -> 0xb2b0f04555daca474f0f77d0966945c9/ordinary_recovery_declaration.Declaration<S, 0xb2b0f04555daca474f0f77d0966945c9/owner_product.Owner<0xb2b0f04555daca474f0f77d0966945c9/world.World<S, C, R, E>, Capture>, List<&1, 0xb2b0f04555daca474f0f77d0966945c9/recoverable_array.Record<P>>, Ops(S, P, identity), grant(S, C, E, Capture, R, P, FieldRest, fieldLens, identity)>

Derive the recoverable selected Array resource declaration from its canonical Binding. Initializes empty recovery records and publishes known Write-use metadata for this resource key. Shared recovery composition controls finish/undo order; there is no caller-authored inverse or automatic external-effect rollback. See docs/parity/recovery.md for explicit owned recovery boundaries.