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

Method handleNodeStart

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

Source from the content-addressed store, hash-verified

511}
512
513func (a *API) handleNodeStart(w http.ResponseWriter, r *http.Request, nodeID string) {
514 if r.Method != http.MethodPost {
515 writeMethodNotAllowed(w, http.MethodPost)
516 return
517 }
518 req, ok := decodeConfigRequest(w, r)
519 if !ok {
520 return
521 }
522 client, err := a.clientFor(nodeID)
523 if err != nil {
524 writeNodeError(w, err)
525 return
526 }
527 ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)
528 defer cancel()
529 out, err := client.Start(ctx, nodes.ConfigRequest{Config: req.Config})
530 if err != nil {
531 writeJSON(w, http.StatusUnprocessableEntity, map[string]any{"error": err.Error()})
532 return
533 }
534 writeJSON(w, http.StatusOK, out)
535}
536
537func (a *API) handleNodeStop(w http.ResponseWriter, r *http.Request, nodeID string) {
538 if r.Method != http.MethodPost {

Callers 1

handleNodeRoutesMethod · 0.95

Calls 7

clientForMethod · 0.95
writeMethodNotAllowedFunction · 0.85
decodeConfigRequestFunction · 0.85
writeNodeErrorFunction · 0.85
writeJSONFunction · 0.70
StartMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected