Remove SnapshotRPC passthrough
The caller has access to the delegate, so we do not gain anything by wrapping the call in Agent.
This commit is contained in:
parent
a2135d012b
commit
85411d6b54
|
@ -1715,15 +1715,6 @@ func (a *Agent) RPC(method string, args interface{}, reply interface{}) error {
|
||||||
return a.delegate.RPC(method, args, reply)
|
return a.delegate.RPC(method, args, reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SnapshotRPC performs the requested snapshot RPC against the Consul server in
|
|
||||||
// a streaming manner. The contents of in will be read and passed along as the
|
|
||||||
// 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 structs.SnapshotReplyFn) error {
|
|
||||||
return a.delegate.SnapshotRPC(args, in, out, replyFn)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Leave is used to prepare the agent for a graceful shutdown
|
// Leave is used to prepare the agent for a graceful shutdown
|
||||||
func (a *Agent) Leave() error {
|
func (a *Agent) Leave() error {
|
||||||
return a.delegate.Leave()
|
return a.delegate.Leave()
|
||||||
|
|
|
@ -31,14 +31,14 @@ func (s *HTTPServer) Snapshot(resp http.ResponseWriter, req *http.Request) (inte
|
||||||
// Don't bother sending any request body through since it will
|
// Don't bother sending any request body through since it will
|
||||||
// be ignored.
|
// be ignored.
|
||||||
var null bytes.Buffer
|
var null bytes.Buffer
|
||||||
if err := s.agent.SnapshotRPC(&args, &null, resp, replyFn); err != nil {
|
if err := s.agent.delegate.SnapshotRPC(&args, &null, resp, replyFn); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
||||||
case "PUT":
|
case "PUT":
|
||||||
args.Op = structs.SnapshotRestore
|
args.Op = structs.SnapshotRestore
|
||||||
if err := s.agent.SnapshotRPC(&args, req.Body, resp, nil); err != nil {
|
if err := s.agent.delegate.SnapshotRPC(&args, req.Body, resp, nil); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
Loading…
Reference in New Issue