Manages the partial causal ordering of events for a particular consumer. This module
maintains a buffer of events to be processed, aiming to process them in the order they
occurred causally.
Atomically marks the event as seen, retrieves any waiting followers,
and releases the processing lock.This operation is atomic to prevent a race condition where a follower
could park itself between the lock release and the followers check.
Mark an event as being processed for the duration of its lifespan through
the ordering system.Yields an EventProcessingCompletion object that will be populated with
any followers after successful processing.
Events may optionally declare that they logically follow another event, so that
we can preserve important event orderings in the face of unreliable delivery and
ordering of messages from the queues.This function keeps track of the ID of each event that this shard has
successfully processed going back to the PRECEDING_EVENT_LOOKBACK period. If an
event arrives that must follow another one, confirm that we have recently seen
and processed that event before proceeding.is
ready to be processed
event (ReceivedEvent): The event to be processed. This object should include
metadata indicating if and what event it follows.
depth (int, optional): The current recursion depth, used to prevent infinite
recursion due to cyclic dependencies between events. Defaults to 0.Raises EventArrivedEarly if the current event shouldn’t be processed yet.