More backup/restore stuff removal

This commit is contained in:
Yuce Tekol 2018-05-29 16:44:57 +03:00
parent 57ba900174
commit 5f2b587e7c
No known key found for this signature in database
GPG key ID: CB59E46D2FB90573
4 changed files with 2 additions and 36 deletions

2
api.go
View file

@ -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{}{},

View file

@ -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)

View file

@ -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

View file

@ -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")