AttestoMCP.Server.Subscriptions (attesto_mcp_server v0.8.0)

Copy Markdown View Source

Bounded, principal/tenant-bound modern subscription registry.

Summary

Types

Modern subscription category flags and resource URI filters.

Functions

Acknowledges one delivered event and releases queue capacity.

Cancels one subscription without affecting its peers.

Returns a specification to start this module under a supervisor.

Gracefully closes one subscription.

Opens a subscription and sends an acknowledgment to the sink first.

Publishes a filtered notification with authorization rechecks.

Publishes synchronously, completing after all current subscriptions are enqueued.

Starts the bounded subscription registry.

Returns bounded public counters for active subscriptions and queued events.

Types

filter()

@type filter() :: %{optional(String.t()) => boolean() | [String.t()]}

Modern subscription category flags and resource URI filters.

Functions

ack(pid, id)

@spec ack(pid(), term()) :: :ok

Acknowledges one delivered event and releases queue capacity.

ack(pid, id, owner)

@spec ack(pid(), term(), pid() | nil) :: :ok

cancel(pid, id)

@spec cancel(pid(), term()) :: :ok

Cancels one subscription without affecting its peers.

cancel(pid, id, owner)

@spec cancel(pid(), term(), pid() | nil) :: :ok

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(pid, id)

@spec close(pid(), term()) :: :ok

Gracefully closes one subscription.

close(pid, id, owner)

@spec close(pid(), term(), pid() | nil) :: :ok

open(pid, principal, tenant, filter, sink \\ self(), tag \\ nil, authorize \\ nil)

@spec open(pid(), term(), term(), term(), pid(), term(), (map() -> boolean()) | nil) ::
  {:ok, term()} | {:error, term()}

Opens a subscription and sends an acknowledgment to the sink first.

open(pid, principal, tenant, id, filter, sink, tag, authorize)

publish(pid, notification, opts \\ [])

@spec publish(pid(), map(), keyword()) :: :ok

Publishes a filtered notification with authorization rechecks.

publish_sync(pid, notification, opts \\ [])

@spec publish_sync(pid(), map(), keyword()) :: :ok

Publishes synchronously, completing after all current subscriptions are enqueued.

start_link(opts \\ [])

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

Starts the bounded subscription registry.

stats(pid)

@spec stats(pid()) :: %{count: non_neg_integer(), queued: non_neg_integer()}

Returns bounded public counters for active subscriptions and queued events.