def drain

bendvy-ecs-core@0.1.0.4 · owned_event_storage.bend:62

import bendvy-ecs-core@0.1.0.4/owned_event_storage.bend as OwnedEventStorage
import Base
import bendvy-ecs-core@0.1.0.4/event_runtime.bend as Ev
import bendvy-ecs-core@0.1.0.4/owned_event_log.bend as Log

62# Shutdown clears only queued IDs/batches and log rows. Preserve reader/runtime
63# metadata and Log.next so old IDs cannot alias a later appended payload.
64def drain(~S:Data,~C:Type,~R:Type,~P:Type,runtime:Runtime(~S,~C,~R,~P)) -> Runtime(~S,~C,~R,~P) & List<Log.Row<P>>:
65  match runtime:
66    case Ev.Runtime{world,namespace,_,positions,nextReader,tick,frameStart,boundary,capacity,dropped}:
67      runtime_returned(~S,~C,~R,~P,~List<Log.Row<P>>,namespace,[],positions,nextReader,tick,frameStart,boundary,capacity,dropped,cleared_events(~S,~C,~R,~P,with_resources(~S,~C,~R,~P,~List<Log.Row<P>>,drain_resources(~R,~P),world)))

Uses (9)

Used by (0)

No other definition uses this definition.