Atomic authorization-store boundary for MCP OAuth state.
Store adapters implement one closed transaction callback. The public
functions below define the supported operation vocabulary; callers cannot
submit arbitrary functions or inspect adapter-owned state. Every operation
that reads or mutates a grant is fenced by both principal and authority
epochs carried in GrantKey.
Persistent adapters must encrypt secret fields at rest, use an adapter-authoritative clock, and make each operation crash-atomic at this callback boundary. PtcRunner ships only the owner-process in-memory adapter; no durable adapter or persistence recommendation is included.
transact/3 receives the absolute deadline captured by the caller.
Adapters must check it again at their serialized mutation boundary and return
{:error, :timeout} without changing state when it has expired. Store
wrappers must forward that exact deadline rather than replacing it with a new
relative timeout.
Summary
Functions
Returns an opaque process-local identity shared by wrappers of one store.
Recovers one exact mutation only after its dispatch worker has been irreversibly fenced.
Types
Callbacks
Functions
@spec acquire_mutation( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), :refresh | :authorization, pos_integer(), request_deadline() ) :: {:ok, %{fence: term(), starting_generation: non_neg_integer()}} | {:error, atom()}
@spec admit_mcp( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), non_neg_integer(), pos_integer(), request_deadline() ) :: {:ok, term()} | {:error, atom()}
@spec admit_mcp( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), non_neg_integer(), pid(), pos_integer(), request_deadline() ) :: {:ok, term()} | {:error, atom()}
@spec begin_flow( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), map(), pos_integer(), request_deadline() ) :: {:ok, map()} | {:error, atom()}
@spec begin_mutation_dispatch( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), term(), map(), request_deadline() ) :: :ok | {:error, atom()}
@spec cancel_flow( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), term(), request_deadline() ) :: :ok | {:error, atom()}
@spec commit_grant( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), term(), map(), pos_integer(), term(), request_deadline() ) :: {:ok, map()} | {:error, atom()}
@spec fail_mutation( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), term(), :not_dispatched | :possibly_dispatched | :invalid_grant, request_deadline() ) :: :ok | {:error, atom()}
@spec load_grant(t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), request_deadline()) :: {:ok, map() | nil} | {:error, atom()}
@spec load_requirement( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), request_deadline() ) :: {:ok, map() | nil} | {:error, atom()}
Returns an opaque process-local identity shared by wrappers of one store.
Adapters that can be wrapped should implement local_identity/1 and return
the same non-secret identity for every handle to the same backing store.
@spec mark_access_rejected( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), non_neg_integer(), request_deadline() ) :: :ok | {:error, atom()}
@spec recover_mutation( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), term(), :worker_fenced, request_deadline() ) :: :ok | {:error, atom()}
Recovers one exact mutation only after its dispatch worker has been irreversibly fenced.
A refresh is poisoned and an authorization-code flow is terminalized. Lease expiry alone is not proof of fencing and is insufficient for this operation.
@spec terminalize_flow( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), term(), request_deadline() ) :: :ok | {:error, atom()}
@spec upsert_requirement( t(), PtcRunner.Kernel.MCPOAuth.GrantKey.t(), non_neg_integer(), MapSet.t(binary()), pos_integer(), request_deadline() ) :: {:ok, non_neg_integer()} | {:error, atom()}