View Source Bonfire.Federate.ActivityPub.FederationModules (bonfire v0.3.5-classic-beta.4)

A Global cache of known federation modules to be queried by activity and/or object type.

Use of the FederationModules Service requires:

  1. Exporting federation_module/0 in relevant modules (in context modules indicating what activity or object types the module can handle)
  2. To populate :bonfire, :federation_search_path in config with the list of OTP applications where federation modules are declared.
  3. Start the Bonfire.Federate.ActivityPub.FederationModules application before querying.
  4. OTP 21.2 or greater, though we recommend using the most recent release available.

While this module is a GenServer, it is only responsible for setup of the cache and then exits with :ignore having done so. It is not recommended to restart the service as this will lead to a stop the world garbage collection of all processes and the copying of the entire cache to each process that has queried it since its last local garbage collection.

Link to this section Summary

Types

A query is either a federation_module name atom or (Pointer) id binary

Functions

Returns a specification to start this module under a supervisor.

Look up a Federation Module, throw :not_found if not found.

Get a Federation Module identified by activity and/or object type, as string or {activity, object} tuple.

Look up many types at once, throw :not_found if any of them are not found

Populates the global cache with federation_module data via introspection.

Link to this section Types

@type query() :: binary() | atom() | tuple()

A query is either a federation_module name atom or (Pointer) id binary

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

federation_function_error(error, args)

View Source
Link to this function

federation_module!(query)

View Source

Look up a Federation Module, throw :not_found if not found.

Link to this function

federation_module(query)

View Source
@spec federation_module(query :: query()) :: {:ok, atom()} | {:error, :not_found}

Get a Federation Module identified by activity and/or object type, as string or {activity, object} tuple.

Link to this function

federation_modules(modules)

View Source
@spec federation_modules([binary() | atom()]) :: [binary()]

Look up many types at once, throw :not_found if any of them are not found

Link to this function

maybe_federation_module(query)

View Source
@spec start_link(ignored :: term()) :: GenServer.on_start()

Populates the global cache with federation_module data via introspection.