cluster

package
v4.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package cluster supports intracluster control messaging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Join

func Join(joinAddr []string, advAddr string, skipVerify bool) (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 Raft address of the joining node as advAddr. It returns the endpoint successfully used to join the cluster.

Types

type Service

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

Service allows access to the cluster and associated meta data, via consensus.

func NewService

func NewService(tn Transport, store Store) *Service

NewService returns a new instance of the cluster service

func (*Service) Addr

func (s *Service) Addr() string

Addr returns the address the service is listening on.

func (*Service) Close

func (s *Service) Close() error

Close closes the service.

func (*Service) Open

func (s *Service) Open() error

Open opens the Service.

func (*Service) SetPeer

func (s *Service) SetPeer(raftAddr, apiAddr string) error

SetPeer will set the mapping between raftAddr and apiAddr for the entire cluster.

type Store

type Store interface {
	// Leader returns the leader of the consensus system.
	Leader() string

	// UpdateAPIPeers updates the API peers on the store.
	UpdateAPIPeers(peers map[string]string) error
}

Store represents a store of information, managed via consensus.

type Transport

type Transport interface {
	net.Listener

	// Dial is used to create a new outgoing connection
	Dial(address string, timeout time.Duration) (net.Conn, error)
}

Transport is the interface the network service must provide.

Jump to

Keyboard shortcuts

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