Anubis.Server.Transport.StreamableHTTP.EventStore.InMemory (anubis_mcp v1.14.0)

Copy Markdown

In-memory Anubis.Server.Transport.StreamableHTTP.EventStore adapter backed by a single GenServer.

Each session keeps a bounded ring of the most recent {event_id, data} pairs. Event ids are drawn from a single store-wide monotonic counter, so they never restart at 1 for a session that was evicted and later reappears — a reconnect carrying an old higher Last-Event-ID therefore never filters out genuinely newer events. This is the default adapter and is suitable for single-node HTTP deployments: it makes short reconnect gaps seamless without any external dependency.

Bounds

  • :history_size — events retained per session (default 100). Older events are evicted; a client whose Last-Event-ID predates the ring recovers only the events still held (see the EventStore behaviour on gaps).
  • :max_sessions — sessions retained before the least-recently-appended one is evicted (default 1_000, or :infinity to disable). This bounds memory for servers that churn sessions without an explicit DELETE. Sessions are also dropped promptly on delete/2. Because ids come from the store-wide counter, an evicted session that reappends resumes with strictly larger ids.

Events are lost on process restart. Recovery across restarts is a host-level concern (e.g. a durable journal), by design: the transport ring exists to make live reconnects seamless, not to be a system of record.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts the in-memory event store.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_schema(atom)

parse_options(data)

parse_options!(data)

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts the in-memory event store.

Options

  • :name — registered process name (required)
  • :history_size — events retained per session (default 100)
  • :max_sessions — sessions retained before LRU eviction, or :infinity (default 1000)