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

Method ServeHTTP

progress.go:29–54  ·  view source on GitHub ↗
(w http.ResponseWriter, req *http.Request)

Source from the content-addressed store, hash-verified

27}
28
29func (h *ProgressStatsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
30 indexName := rest.IndexNameLookup(req)
31 if indexName == "" {
32 rest.ShowError(w, req, "index name is required", http.StatusBadRequest)
33 return
34 }
35
36 indexProgressStats, _ := gatherIndexProgressStats(h.mgr, indexName)
37
38 docCount, _ := indexProgressStats["doc_count"].(uint64)
39 totSeqReceived, _ := indexProgressStats["tot_seq_received"].(uint64)
40 numMutationsToIndex, _ := indexProgressStats["num_mutations_to_index"].(uint64)
41
42 rv := struct {
43 Status string `json:"status"`
44 DocCount uint64 `json:"doc_count"`
45 TotSeqReceived uint64 `json:"tot_seq_received"`
46 NumMutationsToIndex uint64 `json:"num_mutations_to_index"`
47 }{
48 Status: "ok",
49 DocCount: docCount,
50 NumMutationsToIndex: numMutationsToIndex,
51 TotSeqReceived: totSeqReceived,
52 }
53 rest.MustEncode(w, rv)
54}
55
56// ---------------------------------------------------------------
57

Callers

nothing calls this directly

Calls 1

gatherIndexProgressStatsFunction · 0.85

Tested by

no test coverage detected