Routemaster Client v0.3.0 Routemaster.Drain.EventState View Source
Persisted data.
Each EventState
is associated to the URL of a resource and
stores the timestamp of the latest Drain event received for
that URL.
They are stored in Redis, with the URL acting as key.
They are used to keep track of the most recent event for a resource and to filter out stale events receivied out of order.
Link to this section Summary
Functions
Checks if a Routemaster.Drain.Event
is more recent than the
previous received events for the same URL (for the same resource)
Looks up and EventState
struct in Redis by URL. If nothing is
found, it returns a null struct with timestamp equal to zero
which will be considered older than any real data
Given a Routemaster.Drain.Event
, it stores an EventState
in
Redis with the event URL and timestamp
Link to this section Types
t() :: %Routemaster.Drain.EventState{ url: Routemaster.Drain.Event.url(), t: Routemaster.Drain.Event.timestamp() }
Link to this section Functions
Checks if a Routemaster.Drain.Event
is more recent than the
previous received events for the same URL (for the same resource).
In practical terms, it compares the timestamp r
of the event with
the stored timestamp of the most recent previously received event.
Looks up and EventState
struct in Redis by URL. If nothing is
found, it returns a null struct with timestamp equal to zero
which will be considered older than any real data.
save(Routemaster.Drain.Event.t()) :: :ok | {:error, any()}
Given a Routemaster.Drain.Event
, it stores an EventState
in
Redis with the event URL and timestamp.