MCPcopy Create free account
hub / github.com/couchbase/cbft / ServeHTTP

Method ServeHTTP

rest_backup_restore.go:376–407  ·  view source on GitHub ↗
(
	w http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

374}
375
376func (h *BackupIndexHandler) ServeHTTP(
377 w http.ResponseWriter, req *http.Request) {
378 queryParams := req.URL.Query()
379 var include bool
380 params := queryParams.Get("exclude")
381 if params == "" {
382 params = queryParams.Get("include")
383 include = true
384 }
385
386 bucketFilters, scopeFilters, colFilters := parseBackupFilters(params, "")
387
388 indexDefs, _, err := cbgt.CfgGetIndexDefs(h.mgr.Cfg())
389 if err != nil {
390 rest.ShowError(w, req, "rest_backup_restore: "+
391 "could not retrieve index defs", http.StatusInternalServerError)
392 return
393 }
394
395 // filter index definitions for the given buckets/scopes/collections.
396 indexDefs = filterIndexDefinitions(indexDefs, bucketFilters,
397 scopeFilters, colFilters, include, false)
398
399 rv := struct {
400 Status string `json:"status"`
401 IndexDefs *cbgt.IndexDefs `json:"indexDefs"`
402 }{
403 Status: "ok",
404 IndexDefs: indexDefs,
405 }
406 rest.MustEncode(w, rv)
407}
408
409// BucketBackupIndexHandler is a REST handler that processes
410// a backup request at a bucket level.

Callers

nothing calls this directly

Calls 4

parseBackupFiltersFunction · 0.85
filterIndexDefinitionsFunction · 0.85
GetMethod · 0.80
QueryMethod · 0.45

Tested by

no test coverage detected