TantivyEx.Distributed.Coordinator (TantivyEx v0.4.1)
View SourceCentral coordinator for distributed search operations.
This GenServer manages the overall distributed search configuration, orchestrates searches across multiple nodes, and handles failover.
Summary
Functions
Add a search node to the cluster.
Returns a specification to start this module under a supervisor.
Configure the distributed search behavior.
Get list of active nodes.
Get cluster statistics.
Remove a search node from the cluster.
Perform a distributed search across all active nodes.
Set node active/inactive status.
Start the coordinator GenServer.
Types
@type config() :: %{ timeout_ms: non_neg_integer(), max_retries: non_neg_integer(), merge_strategy: merge_strategy(), load_balancing: load_balancing_strategy(), health_check_interval: non_neg_integer() }
@type load_balancing_strategy() ::
:round_robin | :weighted_round_robin | :least_connections | :health_based
@type merge_strategy() :: :score_desc | :score_asc | :node_order | :round_robin
Functions
@spec add_node(GenServer.server(), String.t(), String.t(), float()) :: :ok | {:error, term()}
Add a search node to the cluster.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec configure(GenServer.server(), config()) :: :ok | {:error, term()}
Configure the distributed search behavior.
@spec get_active_nodes(GenServer.server()) :: {:ok, [String.t()]}
Get list of active nodes.
@spec get_cluster_stats(GenServer.server()) :: {:ok, map()}
Get cluster statistics.
@spec remove_node(GenServer.server(), String.t()) :: :ok | {:error, term()}
Remove a search node from the cluster.
@spec search(GenServer.server(), term(), non_neg_integer(), non_neg_integer()) :: {:ok, map()} | {:error, term()}
Perform a distributed search across all active nodes.
@spec set_node_status(GenServer.server(), String.t(), boolean()) :: :ok | {:error, term()}
Set node active/inactive status.
Start the coordinator GenServer.