Browse Source

functional/agent: add "handle_FETCH_SNAPSHOT"

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
2942a8044d
1 changed files with 14 additions and 0 deletions
  1. 14 0
      functional/agent/handler.go

+ 14 - 0
functional/agent/handler.go

@@ -57,6 +57,9 @@ func (srv *Server) handleTesterRequest(req *rpcpb.Request) (resp *rpcpb.Response
 	case rpcpb.Operation_SIGQUIT_ETCD_AND_REMOVE_DATA:
 		return srv.handle_SIGQUIT_ETCD_AND_REMOVE_DATA()
 
+	case rpcpb.Operation_FETCH_SNAPSHOT:
+		return srv.handle_FETCH_SNAPSHOT()
+
 	case rpcpb.Operation_SIGQUIT_ETCD_AND_ARCHIVE_DATA:
 		return srv.handle_SIGQUIT_ETCD_AND_ARCHIVE_DATA()
 	case rpcpb.Operation_SIGQUIT_ETCD_AND_REMOVE_DATA_AND_STOP_AGENT:
@@ -502,6 +505,17 @@ func (srv *Server) handle_SIGQUIT_ETCD_AND_REMOVE_DATA() (*rpcpb.Response, error
 	}, nil
 }
 
+func (srv *Server) handle_FETCH_SNAPSHOT() (*rpcpb.Response, error) {
+	err := srv.Member.FetchSnapshot(srv.lg)
+	if err != nil {
+		return nil, err
+	}
+	return &rpcpb.Response{
+		Success: true,
+		Status:  "downloaded snapshot",
+	}, nil
+}
+
 func (srv *Server) handle_SIGQUIT_ETCD_AND_ARCHIVE_DATA() (*rpcpb.Response, error) {
 	srv.stopProxy()