leaderregistry

package
v0.0.0-...-3b62d95 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2023 License: MIT Imports: 12 Imported by: 0

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

type LeaderProvider interface {
	GetLeader() (registry.Address, error)
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL