Removes Raft types from public API interface.

This will cause a lot of breakage because we've currently vendored a
branch of the Raft library.
This commit is contained in:
James Phillips 2016-08-30 14:59:16 -07:00
parent ee0e331aca
commit 5e4db081f7
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
2 changed files with 4 additions and 10 deletions

View File

@ -1,9 +1,5 @@
package api package api
import (
"github.com/hashicorp/raft"
)
// Operator can be used to perform low-level operator tasks for Consul. // Operator can be used to perform low-level operator tasks for Consul.
type Operator struct { type Operator struct {
c *Client c *Client
@ -19,14 +15,14 @@ type RaftServer struct {
// ID is the unique ID for the server. These are currently the same // ID is the unique ID for the server. These are currently the same
// as the address, but they will be changed to a real GUID in a future // as the address, but they will be changed to a real GUID in a future
// release of Consul. // release of Consul.
ID raft.ServerID ID string
// Node is the node name of the server, as known by Consul, or this // Node is the node name of the server, as known by Consul, or this
// will be set to "(unknown)" otherwise. // will be set to "(unknown)" otherwise.
Node string Node string
// Address is the IP:port of the server, used for Raft communications. // Address is the IP:port of the server, used for Raft communications.
Address raft.ServerAddress Address string
// Leader is true if this server is the current cluster leader. // Leader is true if this server is the current cluster leader.
Leader bool Leader bool
@ -67,7 +63,7 @@ func (op *Operator) RaftGetConfiguration(q *QueryOptions) (*RaftConfiguration, e
// RaftRemovePeerByAddress is used to kick a stale peer (one that it in the Raft // RaftRemovePeerByAddress is used to kick a stale peer (one that it in the Raft
// quorum but no longer known to Serf or the catalog) by address in the form of // quorum but no longer known to Serf or the catalog) by address in the form of
// "IP:port". // "IP:port".
func (op *Operator) RaftRemovePeerByAddress(address raft.ServerAddress, q *WriteOptions) error { func (op *Operator) RaftRemovePeerByAddress(address string, q *WriteOptions) error {
r := op.c.newRequest("DELETE", "/v1/operator/raft/peer") r := op.c.newRequest("DELETE", "/v1/operator/raft/peer")
r.setWriteOptions(q) r.setWriteOptions(q)

View File

@ -6,7 +6,6 @@ import (
"strings" "strings"
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
"github.com/hashicorp/raft"
"github.com/mitchellh/cli" "github.com/mitchellh/cli"
"github.com/ryanuber/columnize" "github.com/ryanuber/columnize"
) )
@ -160,8 +159,7 @@ func (c *OperatorCommand) raft(args []string) error {
w := &api.WriteOptions{ w := &api.WriteOptions{
Token: token, Token: token,
} }
sa := raft.ServerAddress(address) if err := operator.RaftRemovePeerByAddress(address, w); err != nil {
if err := operator.RaftRemovePeerByAddress(sa, w); err != nil {
return err return err
} }
c.Ui.Output(fmt.Sprintf("Removed peer with address %q", address)) c.Ui.Output(fmt.Sprintf("Removed peer with address %q", address))