RigInboundGatewayWeb.EventBuffer (Reactive Interaction Gateway v3.0.0-alpha.2) View Source

A circular buffer for events.

Buffers events up to a configurable capacity. After that, every new item overwrites the oldest one.

Link to this section Summary

Types

t()

A circular event buffer.

Functions

Add an event to this buffer.

All events, sorted from oldest to newest event.

The capacity is the maximum number of events this buffer can hold.

Creates a new EventBuffer with the given capacity.

Link to this section Types

Specs

t() :: %RigInboundGatewayWeb.EventBuffer{
  capacity: pos_integer(),
  events: [RigCloudEvents.CloudEvent.t()]
}

A circular event buffer.

Link to this section Functions

Link to this function

add_event(event_buffer, event)

View Source

Specs

add_event(t(), RigCloudEvents.CloudEvent.t()) :: t()

Add an event to this buffer.

If the buffer runs at full capacity, this overwrites the oldest event in the buffer.

Specs

all_events(t()) :: [RigCloudEvents.CloudEvent.t()]

All events, sorted from oldest to newest event.

Specs

capacity(t()) :: pos_integer()

The capacity is the maximum number of events this buffer can hold.

Link to this function

events_since(map, event_id)

View Source

Specs

events_since(t(), event_id :: String.t()) ::
  {:ok, [events: [RigCloudEvents.CloudEvent.t()], last_event_id: String.t()]}
  | {:no_such_event, [not_found_id: String.t(), last_event_id: String.t()]}

Specs

new(pos_integer()) :: t()

Creates a new EventBuffer with the given capacity.