Documentation
¶
Overview ¶
Package leaderrunner factors the "run this loop only while we hold raft leadership" boilerplate shared by every leader-gated control-plane loop (scheduler, orchestrator, dispatcher, janitors). Each such loop used to reimplement the same wait-for-leadership/re-check dance; Run centralizes it so leadership transitions are handled one way.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run invokes leaderLoop whenever this node holds leadership and blocks until ctx is canceled. leaderLoop is expected to return promptly once it observes leadership loss (via the store's LeaderCh or an ErrNotLeader apply); Run then waits for the next election and re-invokes it. leaderLoop receives ctx directly, so a daemon shutdown unwinds it too.