View Source Actors.Registry.ActorRegistry (spawn v1.3.3)

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

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.

Functions

Link to this function

get_hosts_by_actor(actor_id, opts \\ [])

View Source
@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)
Link to this function

lookup(id, opts \\ [])

View Source (since 0.1.0)
@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.

Link to this function

register(hosts)

View Source (since 0.1.0)
@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