def frame

bendvy-ecs-core@0.1.0.4 · event_stream.bend:53

import bendvy-ecs-core@0.1.0.4/event_stream.bend as EventStream
import Base
import bendvy-ecs-core@0.1.0.4/event_runtime.bend as Ev

53# Apply frame-window and capacity trimming with current active-reader holds.
54# Return metadata with updated boundaries/dropped history; hard capacity can cause
55# lag, so active readers do not promise indefinite retention.
56def frame(~S:Data,~E:Data,stream:Stream<S,E>,+tick:Nat) -> Stream<S,E>:
57  match stream:
58    case Stream{domain,batches,+positions,nextReader,+frameStart,_,+capacity,dropped}:trimmed(~S,~E,domain,positions,nextReader,tick,frameStart,capacity,Ev.trim_capacity(~E,Ev.past_window(~E,batches,Ev.hold_boundary(positions,frameStart),dropped),capacity))

Uses (6)

Used by (2)