View Source Actors.Registry.ActorRegistry (spawn v1.0.1)
The ActorRegistry
module provides a registry for actor entities.
It allows for registering and looking up actors and also provides methods for adding and removing invocation requests for actors.
Summary
Functions
Get all invocations stored for actor
Retrieves a list of hosts associated with a given actor. Parameters
Fetch current entities of the service.
Returns HostActor
with Host and specific actor.
Register member
entities to the ActorRegistry.
Returns Cluster
with all Host members.
Registers a invocation request in CRDT Database Usually used for invocation schedulings
Removes a invocation request in CRDT Database Usually used for invocation schedulings
Functions
Get all invocations stored for actor
Examples
iex> ActorRegistry.get_all_invocations()
[<<10, 14, 10, 12, 115, 112>>]
@spec get_hosts_by_actor(Eigr.Functions.Protocol.Actors.ActorId.t(), Keyword.t()) :: {:ok, Member.t()} | {:not_found, []}
Retrieves a list of hosts associated with a given actor. Parameters
actor_id (%ActorId{}): The ID of the actor. opts (Keyword, optional): Options for the function.
:parent (boolean): If true, filter hosts by parent; otherwise, filter by name.
Returns
: A tuple with :ok and a list of hosts. {:not_found, []}: If no hosts are found.
Examples
actor_id = %ActorId{parent: "parent", name: "name"}
opts = [parent: true]
{:ok, hosts} = Actors.Registry.ActorRegistry.get_hosts_by_actor(actor_id, opts)
@spec lookup(Eigr.Functions.Protocol.Actors.ActorId.t(), Keyword.t()) :: {:ok, Actors.Registry.HostActor.t()} | {:not_found, []}
Fetch current entities of the service.
Returns HostActor
with Host and specific actor.
@spec register([Actors.Registry.HostActor.t()]) :: :ok
Register member
entities to the ActorRegistry.
Returns Cluster
with all Host members.
Examples
iex> hosts = [%HostActor{node: Node.self(), actor: actor, opts: []}}]
iex> ActorRegistry.register(hosts)
:ok
Registers a invocation request in CRDT Database Usually used for invocation schedulings
Removes a invocation request in CRDT Database Usually used for invocation schedulings