cluster

package
v0.0.0-...-83e654d Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNodeNotInSync = errors.New("Node not found in syncPartitions list.")

	ErrMissingSyncPartition = errors.New("Missing sync partition")
)
View Source
var (
	ErrNodeNotFound = errors.New("Node not found.")
)

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	// Pointer to a Config struct, based on which the Cluster node is created and runs.
	Config *Config

	// Router is used for dispatching messages received by this node.
	// Should be set after the node is created with New(), and before Start().
	Router router
	// contains filtered or unexported fields
}

Cluster is a struct for managing the `local view` of the guble cluster, as seen by a node.

func New

func New(config *Config) (*Cluster, error)

New returns a new instance of the cluster, created using the given Config.

func (*Cluster) BroadcastMessage

func (cluster *Cluster) BroadcastMessage(pMessage *protocol.Message) error

BroadcastMessage broadcasts a guble-protocol-message to all the other nodes in the guble cluster.

func (*Cluster) BroadcastString

func (cluster *Cluster) BroadcastString(sMessage *string) error

BroadcastString broadcasts a string to all the other nodes in the guble cluster

func (*Cluster) Check

func (cluster *Cluster) Check() error

Check returns a non-nil error if the health status of the cluster (as seen by this node) is not perfect.

func (*Cluster) GetBroadcasts

func (cluster *Cluster) GetBroadcasts(overhead, limit int) [][]byte

func (*Cluster) GetNodeByID

func (cluster *Cluster) GetNodeByID(id uint8) *memberlist.Node

func (*Cluster) LocalState

func (cluster *Cluster) LocalState(join bool) []byte

func (*Cluster) MergeRemoteState

func (cluster *Cluster) MergeRemoteState(s []byte, join bool)

func (*Cluster) NodeMeta

func (cluster *Cluster) NodeMeta(limit int) []byte

func (*Cluster) NotifyConflict

func (cluster *Cluster) NotifyConflict(existing, other *memberlist.Node)

func (*Cluster) NotifyJoin

func (cluster *Cluster) NotifyJoin(node *memberlist.Node)

func (*Cluster) NotifyLeave

func (cluster *Cluster) NotifyLeave(node *memberlist.Node)

func (*Cluster) NotifyMsg

func (cluster *Cluster) NotifyMsg(data []byte)

NotifyMsg is invoked each time a message is received by this node of the cluster; it decodes and dispatches the messages.

func (*Cluster) NotifyUpdate

func (cluster *Cluster) NotifyUpdate(node *memberlist.Node)

func (*Cluster) Start

func (cluster *Cluster) Start() error

Start the cluster module.

func (*Cluster) Stop

func (cluster *Cluster) Stop() error

Stop the cluster module.

type Config

type Config struct {
	ID                   uint8
	Host                 string
	Port                 int
	Remotes              []*net.TCPAddr
	HealthScoreThreshold int
}

Config is a struct used by the local node when creating and running the guble cluster

Jump to

Keyboard shortcuts

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