bootstrap

package
v1.29.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveRemoteNodes added in v1.25.15

func ResolveRemoteNodes(addrResolver resolver.NodeToAddress, serverPortMap map[string]int) []string

ResolveRemoteNodes returns a list of remoteNodes addresses resolved using addrResolver. The nodes id used are taken from serverPortMap keys and ports from the values

Types

type Bootstrapper

type Bootstrapper struct {
	// contains filtered or unexported fields
}

Bootstrapper is used to bootstrap this node by attempting to join it to a RAFT cluster.

func NewBootstrapper

func NewBootstrapper(peerJoiner PeerJoiner, raftID string, raftAddr string, voter bool, r resolver.NodeToAddress, isStoreReady func() bool) *Bootstrapper

NewBootstrapper constructs a new bootsrapper

func (*Bootstrapper) Do

func (b *Bootstrapper) Do(ctx context.Context, serverPortMap map[string]int, lg *logrus.Logger, stop chan struct{}) error

Do iterates over a list of servers in an attempt to join this node to a cluster.

type Joiner added in v1.25.15

type Joiner struct {
	// contains filtered or unexported fields
}

func NewJoiner added in v1.25.15

func NewJoiner(peerJoiner PeerJoiner, localNodeID string, localRaftAddr string, voter bool) *Joiner

NewJoiner returns a *Joiner configured with localNodeID, localRaftAddr and voter.

func (*Joiner) Do added in v1.25.15

func (j *Joiner) Do(ctx context.Context, lg *logrus.Logger, remoteNodes []string) (string, error)

Do will attempt to send to any nodes in remoteNodes a JoinPeerRequest for j.localNodeID with the address j.localRaftAddr. Will join as voter if j.voter is true, non voter otherwise. Returns the leader address if a cluster was joined or an error otherwise.

type PeerJoiner added in v1.25.15

type PeerJoiner interface {
	Join(_ context.Context, leaderAddr string, _ *cmd.JoinPeerRequest) (*cmd.JoinPeerResponse, error)
	Notify(_ context.Context, leaderAddr string, _ *cmd.NotifyPeerRequest) (*cmd.NotifyPeerResponse, error)
}

PeerJoiner is the interface we expect to be able to talk to the other peers to either Join or Notify them

Jump to

Keyboard shortcuts

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