Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLeaderRegistry ¶
func NewLeaderRegistry( ctx context.Context, lp LeaderProvider, serverID string, envOpts virtual.EnvironmentOptions, ) (registry.Registry, error)
LeaderRegistry creates a new leader-backed registry. The idea with the LeaderRegistry is that the user provides an implementation of LeaderProvider that uses some external mechanism to elect one of the NOLA nodes as the "leader" at any given moment.
The node that is elected as the leader then runs an "in-memory" registry implementation. While the user must provide a leader election implementation via the LeaderProvider interface, the LeaderRegistry implementation takes care of all the actual registry logic, as well as routing all registry requests to whichever I.P address the LeaderProvider says is the current leader.
See the comments in the method body below for more details for how the implementation works (by leveraging NOLA recursively).
Types ¶
type LeaderProvider ¶
LeaderProvider is the interface that must be implemented so the leader registry knows which node / I.P address is the current "leader". It is pluggable so various different leader-election solutions can be used.