PhoenixGenApi.ConfigDb (PhoenixGenApi v1.1.2)

View Source

A GenServer-based cache for storing FunConfig structs, using an ETS table as the backing store.

This cache provides fast, in-memory access to function configurations, which are used by the Executor to handle incoming requests.

The cache is populated and updated by the ConfigPuller module, which fetches configurations from remote nodes.

Summary

Functions

Adds a new function configuration to the cache.

Returns a specification to start this module under a supervisor.

Deletes a function configuration from the cache.

Retrieves a function configuration from the cache.

Returns a list of all request types (keys) in the cache.

Returns a list of all request types (keys) in the cache.

Starts the ConfigDb GenServer.

Updates an existing function configuration in the cache. If the configuration does not exist, it will be added.

Functions

add(config)

@spec add(PhoenixGenApi.Structs.FunConfig.t()) :: :ok

Adds a new function configuration to the cache.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

delete(service, request_type)

@spec delete(String.t(), String.t()) :: :ok

Deletes a function configuration from the cache.

get(service, request_type)

@spec get(String.t(), String.t()) ::
  {:ok, PhoenixGenApi.Structs.FunConfig.t()} | {:error, :not_found}

Retrieves a function configuration from the cache.

Returns {:ok, config} if the configuration is found, or {:error, :not_found} if it is not.

get_all_functions()

@spec get_all_functions() :: %{required(String.t()) => [String.t()]}

Returns a list of all request types (keys) in the cache.

get_all_services()

@spec get_all_services() :: [String.t()]

Returns a list of all request types (keys) in the cache.

start_link(opts \\ [])

Starts the ConfigDb GenServer.

update(config)

@spec update(PhoenixGenApi.Structs.FunConfig.t()) :: :ok

Updates an existing function configuration in the cache. If the configuration does not exist, it will be added.