cluster

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrJoinFailed is returned when a node fails to join a cluster
	ErrJoinFailed = errors.New("failed to join cluster")
)

Functions

func Join

func Join(srcIP string, joinAddr []string, id, addr string, voter bool, meta map[string]string, numAttempts int,
	attemptInterval time.Duration, tlsConfig *tls.Config, authConfig auth.AuthConfig) (string, error)

Join attempts to join the cluster at one of the addresses given in joinAddr. It walks through joinAddr in order, and sets the node ID and Raft address of the joining node as id addr respectively. It returns the endpoint successfully used to join the cluster.

func NewListener

func NewListener(listeners []net.Listener, advertise string) (net.Listener, error)

NewListener creates a Listener. If the advertise is not empty, it will be set as the listener address.

Types

type Listener

type Listener struct {
	net.Listener
	// contains filtered or unexported fields
}

Listener handles the connection of multiple net.Listener, provides listening and accepting new connection.

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

Accept waits and returns the next incoming connection.

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

Addr returns a network address from advertise if the advertise is not empty, otherwise from first listener.

func (*Listener) Close

func (l *Listener) Close() error

Close closes all listeners provided by NewListener, and stops accept the new connection.

Jump to

Keyboard shortcuts

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