Skip to main content

Module events

Module events 

Source
Expand description

The event log, followed in the order it was stored.

§One read, and a wait that every waiter wakes from

events answers the events stored after a cursor that pass its filters, and when none has been stored yet it waits — up to MAX_EVENTS_WAIT_S seconds — for one to be. The wait is on a broadcast of the store’s own signal: every write that stores an event raises it once committed, and every waiting read wakes, reads again and answers or waits on. Twenty reads waiting at once are twenty receivers of one channel rather than twenty takers of one arrival, and none of them holds a runtime worker while it waits, so a status read made meanwhile is answered meanwhile.

§The cursor is the last event examined

Not the last event answered: a row the filters dropped is still a row this read examined, so the next read starts after it rather than examining it again. With no cursor the read starts after the newest event stored at the request — or, scoped to a print, at that print’s first event, so a print is replayed and then followed.

§The end of a print is told whatever the filters say

A read scoped to a print answers that print’s end as stored — its print_ended event’s identifier, instant and outcome — beside the events, and null while it is open, so a reader filtering that event out still learns the print is over.

Structs§

Stored
A broadcast that some event was stored, which every waiting read holds a receiver of.

Constants§

DEFAULT_EVENTS_LIMIT
How many events one read answers when it asks for no number.
MAX_EVENTS_LIMIT
The most events one read answers.
MAX_EVENTS_WAIT_S
The longest an events read waits for one to pass, in seconds.

Functions§

events
Read the event log after a cursor, waiting for an event to pass.