(w http.ResponseWriter, req *http.Request)
| 27 | } |
| 28 | |
| 29 | func (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 |
nothing calls this directly
no test coverage detected