diff --git a/agent/agent.go b/agent/agent.go index 59181a69d..e1f743c99 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -68,7 +68,7 @@ type delegate interface { JoinLAN(addrs []string) (n int, err error) RemoveFailedNode(node string) error RPC(method string, args interface{}, reply interface{}) error - SnapshotRPC(args *structs.SnapshotRequest, in io.Reader, out io.Writer, replyFn consul.SnapshotReplyFn) error + SnapshotRPC(args *structs.SnapshotRequest, in io.Reader, out io.Writer, replyFn structs.SnapshotReplyFn) error Shutdown() error Stats() map[string]map[string]string } @@ -1080,7 +1080,7 @@ func (a *Agent) RPC(method string, args interface{}, reply interface{}) error { // payload, and the response message will determine the error status, and any // return payload will be written to out. func (a *Agent) SnapshotRPC(args *structs.SnapshotRequest, in io.Reader, out io.Writer, - replyFn consul.SnapshotReplyFn) error { + replyFn structs.SnapshotReplyFn) error { return a.delegate.SnapshotRPC(args, in, out, replyFn) } diff --git a/agent/consul/client.go b/agent/consul/client.go index f1a475b61..3ea1e19f0 100644 --- a/agent/consul/client.go +++ b/agent/consul/client.go @@ -341,15 +341,11 @@ func (c *Client) RPC(method string, args interface{}, reply interface{}) error { return nil } -// SnapshotReplyFn gets a peek at the reply before the snapshot streams, which -// is useful for setting headers. -type SnapshotReplyFn func(reply *structs.SnapshotResponse) error - // SnapshotRPC sends the snapshot request to one of the servers, reading from // the streaming input and writing to the streaming output depending on the // operation. func (c *Client) SnapshotRPC(args *structs.SnapshotRequest, in io.Reader, out io.Writer, - replyFn SnapshotReplyFn) error { + replyFn structs.SnapshotReplyFn) error { // Locate a server to make the request to. server := c.servers.FindServer() diff --git a/agent/consul/server.go b/agent/consul/server.go index 9d1c9741f..3b319000e 100644 --- a/agent/consul/server.go +++ b/agent/consul/server.go @@ -937,7 +937,7 @@ func (s *Server) RPC(method string, args interface{}, reply interface{}) error { // SnapshotRPC dispatches the given snapshot request, reading from the streaming // input and writing to the streaming output depending on the operation. func (s *Server) SnapshotRPC(args *structs.SnapshotRequest, in io.Reader, out io.Writer, - replyFn SnapshotReplyFn) error { + replyFn structs.SnapshotReplyFn) error { // Perform the operation. var reply structs.SnapshotResponse diff --git a/agent/consul/structs/snapshot.go b/agent/consul/structs/snapshot.go index 3d65e317f..933e6e1d4 100644 --- a/agent/consul/structs/snapshot.go +++ b/agent/consul/structs/snapshot.go @@ -7,6 +7,10 @@ const ( SnapshotRestore ) +// SnapshotReplyFn gets a peek at the reply before the snapshot streams, which +// is useful for setting headers. +type SnapshotReplyFn func(reply *SnapshotResponse) error + // SnapshotRequest is used as a header for a snapshot RPC request. This will // precede any streaming data that's part of the request and is JSON-encoded on // the wire.