From 5f2b587e7cde7944c14f27fad216d6af52b2ccfd Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 29 May 2018 16:44:57 +0300 Subject: [PATCH] More backup/restore stuff removal --- api.go | 2 -- client.go | 31 ------------------------------- cmd/root_test.go | 2 +- handler.go | 3 +-- 4 files changed, 2 insertions(+), 36 deletions(-) diff --git a/api.go b/api.go index c8b4b6666..d12204fd2 100644 --- a/api.go +++ b/api.go @@ -894,7 +894,6 @@ const ( apiRecalculateCaches apiRemoveNode apiResizeAbort - apiRestoreFrame //apiSchema // not implemented apiSetCoordinator apiSliceNodes @@ -935,7 +934,6 @@ var methodsNormal = map[apiMethod]struct{}{ apiQuery: struct{}{}, apiRecalculateCaches: struct{}{}, apiRemoveNode: struct{}{}, - apiRestoreFrame: struct{}{}, apiSliceNodes: struct{}{}, apiUnmarshalFragment: struct{}{}, apiViews: struct{}{}, diff --git a/client.go b/client.go index a5b630e10..3ff445a22 100644 --- a/client.go +++ b/client.go @@ -669,36 +669,6 @@ func (c *InternalHTTPClient) CreateFrame(ctx context.Context, index, frame strin } } -// RestoreFrame restores an entire frame from a host in another cluster. -func (c *InternalHTTPClient) RestoreFrame(ctx context.Context, host, index, frame string) error { - u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s/frame/%s/restore", index, frame)) - u.RawQuery = url.Values{ - "host": {host}, - }.Encode() - - // Build request. - req, err := http.NewRequest("POST", u.String(), nil) - if err != nil { - return errors.Wrap(err, "creating request") - } - req.Header.Set("Content-Type", "application/octet-stream") - req.Header.Set("User-Agent", "pilosa/"+Version) - - // Execute request. - resp, err := c.HTTPClient.Do(req.WithContext(ctx)) - if err != nil { - return errors.Wrap(err, "executing request") - } - resp.Body.Close() - - // Return error if response not OK. - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("unexpected status code: host=%s, code=%d", host, resp.StatusCode) - } - - return nil -} - // FrameViews returns a list of view names for a frame. func (c *InternalHTTPClient) FrameViews(ctx context.Context, index, frame string) ([]string, error) { // Create URL & HTTP request. @@ -1133,7 +1103,6 @@ type InternalClient interface { ImportValue(ctx context.Context, index, frame, field string, slice uint64, vals []FieldValue) error ExportCSV(ctx context.Context, index, frame, view string, slice uint64, w io.Writer) error CreateFrame(ctx context.Context, index, frame string, opt FrameOptions) error - RestoreFrame(ctx context.Context, host, index, frame string) error FrameViews(ctx context.Context, index, frame string) ([]string, error) FragmentBlocks(ctx context.Context, index, frame, view string, slice uint64) ([]FragmentBlock, error) BlockData(ctx context.Context, index, frame, view string, slice uint64, block int) ([]uint64, []uint64, error) diff --git a/cmd/root_test.go b/cmd/root_test.go index 431d3a66f..20c4ec187 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -99,7 +99,7 @@ func (v *validator) Error() error { return v.err } // commandTest represents all possible ways to configure a pilosa command, as // well as a function for validating whether the command worked as expected. // args should be set to everything that comes after "pilosa" on the comand -// line. See tests like backup_test.go for examples. +// line. type commandTest struct { args []string env map[string]string diff --git a/handler.go b/handler.go index 256e3411e..1bdb6529d 100644 --- a/handler.go +++ b/handler.go @@ -87,7 +87,6 @@ func (h *Handler) populateValidators() { h.validators["GetFragmentData"] = queryValidationSpecRequired("index", "frame", "view", "slice") h.validators["PostFragmentData"] = queryValidationSpecRequired("index", "frame", "view", "slice") h.validators["GetFragmentBlocks"] = queryValidationSpecRequired("index", "frame", "view", "slice") - h.validators["PostFrameRestore"] = queryValidationSpecRequired("host") } func (h *Handler) queryArgValidator(next http.Handler) http.Handler { @@ -120,7 +119,7 @@ func NewRouter(handler *Handler) *mux.Router { router.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux).Methods("GET") router.Handle("/debug/vars", expvar.Handler()).Methods("GET") router.HandleFunc("/schema", handler.handleGetSchema).Methods("GET") - router.HandleFunc("/slices/max", handler.handleGetSlicesMax).Methods("GET") // TODO: deprecate, but it's being used by the client (for backups) + router.HandleFunc("/slices/max", handler.handleGetSlicesMax).Methods("GET") // TODO: deprecate, but it's being used by the client router.HandleFunc("/status", handler.handleGetStatus).Methods("GET") router.HandleFunc("/info", handler.handleGetInfo).Methods("GET") router.HandleFunc("/version", handler.handleGetVersion).Methods("GET")