cluster

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const KeyLen = 32

KeyLen is the fixed length of cluster keys, must be checked by callers

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	LocalName string
	// contains filtered or unexported fields
}

Cluster represents a running cluster configuration

func New

func New(name string, init bool, clusterKey []byte, bindAddr string, bindPort int, advertiseAddr string, advertisePort int, useIPAsName bool) (*Cluster, error)

New is used to create a new Cluster instance The returned instance is ready to be updated with the local node settings then joined

func (*Cluster) Join

func (c *Cluster) Join(addrs []string) error

Join tries to join the cluster by contacting provided addresses Provided addresses are passed as is, if no address is provided, known cluster nodes are contacted instead. Joining fail if none of the provided addresses or none of the known nodes can be joined.

func (*Cluster) Leave

func (c *Cluster) Leave()

Leave saves the current state before leaving, then leaves the cluster

func (*Cluster) Members

func (c *Cluster) Members() <-chan []common.Node

Members provides a channel notifying of cluster changes Everytime a change happens inside the cluster (except for local changes), the updated list of cluster nodes is pushed to the channel.

func (*Cluster) Name

func (c *Cluster) Name() string

Name provides the current cluster name

func (*Cluster) Update

func (c *Cluster) Update(localNode *common.Node)

Update gossips the local node configuration, propagating any change

Jump to

Keyboard shortcuts

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