1
0
Fork 0
master
Philip O'Toole 5 years ago
parent a557d8b210
commit 9d595e2ead

@ -19,6 +19,7 @@ import (
const numAttempts int = 3
const attemptInterval time.Duration = 5 * time.Second
// Join attempts to join the cluster at one of the addresses given in joinAddr.
// It walks through joinAddr in order, and sets the node ID and Raft address of
// the joining node as id addr respectively. It returns the endpoint successfully
// used to join the cluster.
@ -74,6 +75,9 @@ func join(joinAddr, id, addr string, meta map[string]string, tlsConfig *tls.Conf
"addr": resv.String(),
"meta": meta,
})
if err != nil {
return "", err
}
// Attempt to join.
resp, err := client.Post(fullAddr, "application-type/json", bytes.NewReader(b))

@ -228,7 +228,7 @@ func (s *Store) Open(enableSingle bool) error {
s.logger.Printf("bootstrap needed")
configuration := raft.Configuration{
Servers: []raft.Server{
raft.Server{
{
ID: config.LocalID,
Address: s.raftTn.LocalAddr(),
},
@ -308,8 +308,8 @@ func (s *Store) ID() string {
return s.raftID
}
// Leader returns the current leader. Returns a blank string if there is
// no leader.
// LeaderAddr returns the address of the current leader. Returns a
// blank string if there is no leader.
func (s *Store) LeaderAddr() string {
return string(s.raft.Leader())
}
@ -730,6 +730,9 @@ func (s *Store) remove(id string) error {
}
c, err := newCommand(metadataDelete, id)
if err != nil {
return err
}
b, err := json.Marshal(c)
if err != nil {
return err

@ -7,6 +7,7 @@ import (
"github.com/hashicorp/raft"
)
// Listener is the interface expected by the Store for Transports.
type Listener interface {
net.Listener
Dial(address string, timeout time.Duration) (net.Conn, error)

@ -22,7 +22,7 @@ func NewTransport() *Transport {
return &Transport{}
}
// NewTransport returns an initialized TLS-ecrypted Transport.
// NewTLSTransport returns an initialized TLS-encrypted Transport.
func NewTLSTransport(certFile, keyPath string, skipVerify bool) *Transport {
return &Transport{
certFile: certFile,

Loading…
Cancel
Save