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

Method handleNodeLogsStream

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

Source from the content-addressed store, hash-verified

469}
470
471func (a *API) handleNodeLogsStream(w http.ResponseWriter, r *http.Request, nodeID string) {
472 if r.Method != http.MethodGet {
473 writeMethodNotAllowed(w, http.MethodGet)
474 return
475 }
476 if _, ok := w.(http.Flusher); !ok {
477 writeJSON(w, http.StatusInternalServerError, map[string]any{"error": "streaming not supported"})
478 return
479 }
480 client, err := a.clientFor(nodeID)
481 if err != nil {
482 writeNodeError(w, err)
483 return
484 }
485 body, err := client.LogsStream(r.Context())
486 if err != nil {
487 writeJSON(w, http.StatusUnprocessableEntity, map[string]any{"error": err.Error()})
488 return
489 }
490 bridgeSSE(w, r, body)
491}
492
493func (a *API) handleNodeUsage(w http.ResponseWriter, r *http.Request, nodeID string) {
494 if r.Method != http.MethodGet {

Callers 1

handleNodeRoutesMethod · 0.95

Calls 7

clientForMethod · 0.95
writeMethodNotAllowedFunction · 0.85
writeNodeErrorFunction · 0.85
bridgeSSEFunction · 0.85
LogsStreamMethod · 0.80
writeJSONFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected