MCPcopy
hub / github.com/NVIDIA/aistore / dsortHandler

Method dsortHandler

ais/proxy.go:2737–2768  ·  view source on GitHub ↗

[METHOD] /v1/sort

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

2735
2736// [METHOD] /v1/sort
2737func (p *proxy) dsortHandler(w http.ResponseWriter, r *http.Request) {
2738 if !p.ClusterStartedWithRetry() {
2739 w.WriteHeader(http.StatusServiceUnavailable)
2740 return
2741 }
2742 if err := p.checkAccess(w, r, nil, apc.AceAdmin); err != nil {
2743 return
2744 }
2745
2746 apiItems, err := cmn.MatchRESTItems(r.URL.Path, 0, true, apc.URLPathdSort.L)
2747 if err != nil {
2748 p.writeErrURL(w, r)
2749 return
2750 }
2751
2752 switch r.Method {
2753 case http.MethodPost:
2754 p.proxyStartSortHandler(w, r)
2755 case http.MethodGet:
2756 dsort.ProxyGetHandler(w, r)
2757 case http.MethodDelete:
2758 if len(apiItems) == 1 && apiItems[0] == apc.Abort {
2759 dsort.ProxyAbortSortHandler(w, r)
2760 } else if len(apiItems) == 0 {
2761 dsort.ProxyRemoveSortHandler(w, r)
2762 } else {
2763 p.writeErrURL(w, r)
2764 }
2765 default:
2766 cmn.WriteErr405(w, r, http.MethodDelete, http.MethodGet, http.MethodPost)
2767 }
2768}
2769
2770// http reverse-proxy handler, to handle unmodified requests
2771// (not to confuse with p.rproxy)

Callers

nothing calls this directly

Calls 10

checkAccessMethod · 0.95
proxyStartSortHandlerMethod · 0.95
MatchRESTItemsFunction · 0.92
ProxyGetHandlerFunction · 0.92
ProxyAbortSortHandlerFunction · 0.92
ProxyRemoveSortHandlerFunction · 0.92
WriteErr405Function · 0.92
WriteHeaderMethod · 0.80
writeErrURLMethod · 0.80

Tested by

no test coverage detected