def staged

bendvy-ecs-core@0.1.0.4 · bundle_batch.bend:77

import bendvy-ecs-core@0.1.0.4/bundle_batch.bend as BundleBatch
import Base
import bendvy-ecs-core@0.1.0.4/deferred_command.bend as Deferred
import bundle_delivery.bend as B
import world.bend as W
import transaction.bend as T

77def staged(~S:Data,~Store:Type,~R:Type,~E:Data,~P:Type,~attempt:W.World<S,Store,R,E> -> W.Handle<S> -> P -> B.Delivery<W.World<S,Store,R,E>,P>,~recover:W.World<S,Store,R,E> -> P -> W.WorldError -> W.World<S,Store,R,E>,prepared:List<Prepared<S,P>>,commands:List<Deferred.Command<W.World<S,Store,R,E>>>,+current:Nat,tx:T.Tx<W.World<S,Store,R,E>,E>) -> T.Tx<W.World<S,Store,R,E>,E>:
78  match prepared:
79    case []: remaining(~W.World<S,Store,R,E>,~E,commands,tx)
80    case ReservationReceipt{target} <> tail: staged(~S,~Store,~R,~E,~P,~attempt,~recover,tail,commands,current,tx)
81    case Prepared{+target,payload,+position} <> tail:
82      staged_after(~S,~Store,~R,~E,~P,~attempt,~recover,target,payload,after => before => staged(~S,~Store,~R,~E,~P,~attempt,~recover,tail,after,position,before),preceding(~W.World<S,Store,R,E>,~E,Nat.sub(position,current),commands,tx))

Uses (13)

Used by (1)