MCPcopy Index your code
hub / github.com/0xUnixIO/pulse / handleNodeRuntime

Method handleNodeRuntime

internal/serverapi/api.go:340–358  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, nodeID string)

Source from the content-addressed store, hash-verified

338}
339
340func (a *API) handleNodeRuntime(w http.ResponseWriter, r *http.Request, nodeID string) {
341 if r.Method != http.MethodGet {
342 writeMethodNotAllowed(w, http.MethodGet)
343 return
344 }
345 client, err := a.clientFor(nodeID)
346 if err != nil {
347 writeNodeError(w, err)
348 return
349 }
350 ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second)
351 defer cancel()
352 out, err := client.Runtime(ctx)
353 if err != nil {
354 writeJSON(w, http.StatusUnprocessableEntity, map[string]any{"error": err.Error()})
355 return
356 }
357 writeJSON(w, http.StatusOK, out)
358}
359
360func (a *API) handleNodeMetrics(w http.ResponseWriter, r *http.Request, nodeID string) {
361 if r.Method != http.MethodGet {

Callers 1

handleNodeRoutesMethod · 0.95

Calls 6

clientForMethod · 0.95
writeMethodNotAllowedFunction · 0.85
writeNodeErrorFunction · 0.85
RuntimeMethod · 0.80
writeJSONFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected