2013-12-09 22:49:07 +00:00
|
|
|
package consul
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Raft endpoint is used to manipulate the Raft subsystem
|
|
|
|
type Raft struct {
|
|
|
|
server *Server
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *Raft) RemovePeer(args string, reply *struct{}) error {
|
|
|
|
peer, err := net.ResolveTCPAddr("tcp", args)
|
|
|
|
if err != nil {
|
2014-01-10 19:06:11 +00:00
|
|
|
r.server.logger.Printf("[ERR] consul.raft: failed to parse peer: %v", err)
|
2013-12-09 22:49:07 +00:00
|
|
|
return err
|
|
|
|
}
|
2013-12-10 00:05:15 +00:00
|
|
|
future := r.server.raft.RemovePeer(peer)
|
2013-12-09 22:49:07 +00:00
|
|
|
return future.Error()
|
|
|
|
}
|
2014-04-01 03:09:16 +00:00
|
|
|
|
|
|
|
func (r *Raft) Snapshot(args struct{}, reply *struct{}) error {
|
|
|
|
future := r.server.raft.Snapshot()
|
|
|
|
return future.Error()
|
|
|
|
}
|