AuroraMeter. Flusher
(Aurora Meter v0.4.0)
View Source
Persists buffered usage in idempotent database batches.
Each immutable batch has a UUID. Storage commits its receipt and counter and history deltas together. An uncertain response retries the same batch, even if another node has since written those counters.
Pending batches live in Store-owned ETS and survive a Flusher restart. Loss of the Store or VM can lose unflushed usage, as with other buffered metering; use durable tracking when that loss is unacceptable.
Summary
Functions
Returns a specification to start this module under a supervisor.
Flushes pending usage. An error retains the batch for an idempotent retry.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec flush() :: {:ok, non_neg_integer()} | {:error, term()}
Flushes pending usage. An error retains the batch for an idempotent retry.
Examples
{:ok, count} = AuroraMeter.Flusher.flush()
is_integer(count)
#=> true