adk_scope_shard_router (erlang_adk v0.10.0)

View Source

Bounded exact-scope router shared by sharded artifact and memory APIs.

The router performs only validation and worker lookup/startup. Calls are made directly to the resolved adapter process, so unrelated exact scopes do not serialize behind one storage GenServer. Each router owns an anonymous dynamic supervisor and stops when its creator exits.

Summary

Types

handle/0

-type handle() :: {adk_scope_shard, pid(), ets:tid(), atomics:atomics_ref(), pos_integer()}.

operation_lease/0

-type operation_lease() :: {adk_scope_operation_lease, pid(), reference()}.

Functions

capabilities(Handle)

-spec capabilities(handle()) -> {ok, map()} | {error, term()}.

code_change(OldVersion, State, Extra)

handle_call(Request, From, State)

handle_cast(Message, State)

handle_info(Message, State)

init(_)

release(Handle, Lease)

-spec release(handle(), term()) -> ok.

Release the exact per-operation lease returned by resolve/3. Passing the token rather than looking it up by scope prevents a crashed worker's late cleanup from decrementing a replacement worker's lease.

resolve(Handle, Scope, Timeout)

-spec resolve(handle(), term(), pos_integer()) ->
                 {ok, module(), pid(), operation_lease()} | {error, term()}.

start_link(Kind, Adapter, AdapterConfig, Options)

-spec start_link(artifact | memory, module(), map(), map()) -> {ok, handle()} | {error, term()}.

status(Handle)

-spec status(handle()) -> {ok, map()} | {error, term()}.

stop(Handle)

-spec stop(handle()) -> ok | {error, term()}.

terminate(Reason, State)

validate_adapter(Kind, Adapter)

-spec validate_adapter(artifact | memory, module()) -> ok | {error, term()}.