cluster

package
v3.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 4, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectionTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

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