Skip to main content

dispatch_persistence

Function dispatch_persistence 

Source
pub fn dispatch_persistence(
    agents: Query<'_, '_, (Entity, &'static RunMetadata, &'static AgentState, &'static ContextWindow, &'static StageCursor, &'static TokenTotals, &'static mut PersistWatermark, Option<&'static mut StageLedger>, Option<&'static mut StageIoBuffer>, Option<&'static TaintGate>, Option<&'static ParentRef>, Option<&'static SubAgentChildren>, Option<&'static FanOutWaiting>, (Option<&'static AwaitingInteractionPoint>, Option<&'static InteractionPointCursor>, Option<&'static InteractionPointRounds>, Option<&'static RunOutcomeFlags>, Option<&'static FinalOutput>))>,
    stage: Res<'_, PersistenceStage>,
    hub: Option<Res<'_, InteractionHub>>,
    sink: Option<Res<'_, WorldEventSink>>,
)
Expand description

Hand each agent’s current state to the persistence lane, which writes it to disk off the schedule thread.

Coalescing lives here rather than in the lane: an agent whose digest has not changed since its last send is skipped, so a world full of idle runs costs nothing per tick.