MCPcopy Create free account
hub / github.com/brimdata/super / handlePoolStats

Function handlePoolStats

service/handlers.go:211–239  ·  view source on GitHub ↗
(c *Core, w *ResponseWriter, r *Request)

Source from the content-addressed store, hash-verified

209}
210
211func handlePoolStats(c *Core, w *ResponseWriter, r *Request) {
212 pool, ok := r.openPool(w, c.root)
213 if !ok {
214 return
215 }
216 //XXX app uses this for key range... should handle this differently
217 // at minimum on a per-branch basis and app needs to be branch aware
218 // If branch not specified, API endpoints here should just assume "main".
219 branch, err := pool.OpenBranchByName(r.Context(), "main")
220 if err != nil {
221 w.Error(err)
222 return
223 }
224 snap, err := branch.Pool().Snapshot(r.Context(), branch.Commit)
225 if err != nil {
226 if errors.Is(err, journal.ErrEmpty) {
227 w.WriteHeader(http.StatusNoContent)
228 return
229 }
230 w.Error(err)
231 return
232 }
233 info, err := exec.GetPoolStats(r.Context(), pool, snap)
234 if err != nil {
235 w.Error(err)
236 return
237 }
238 w.Respond(http.StatusOK, info)
239}
240
241func handlePoolPost(c *Core, w *ResponseWriter, r *Request) {
242 var req api.PoolPostRequest

Callers

nothing calls this directly

Calls 10

GetPoolStatsFunction · 0.92
OpenBranchByNameMethod · 0.80
ContextMethod · 0.80
PoolMethod · 0.80
IsMethod · 0.80
WriteHeaderMethod · 0.80
RespondMethod · 0.80
openPoolMethod · 0.45
ErrorMethod · 0.45
SnapshotMethod · 0.45

Tested by

no test coverage detected