elector_candidate_cache (elector v0.3.3)
View SourceCandidate cache manager - maintains a distributed cache of candidate nodes.
This module implements a smart caching system that: - Monitors node join/leave events - Maintains local cache of candidate nodes - Broadcasts candidate status on startup and node events - Eliminates need for remote calls during elections
Summary
Functions
Returns the current list of candidate nodes from cache.
Refreshes local candidate status and broadcasts to cluster.
Starts the candidate cache manager.
Types
-type state() :: #{cache := candidate_cache(), last_refresh := integer()}.
Functions
-spec get_candidates() -> [node()].
Returns the current list of candidate nodes from cache.
-spec refresh_local_status() -> ok.
Refreshes local candidate status and broadcasts to cluster.
Starts the candidate cache manager.