Package cluster supports intracluster control messaging.



    This section is empty.


    This section is empty.


    func Join

    func Join(joinAddr []string, advAddr string, tlsConfig *tls.Config) (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.


      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 {
                    	// 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.