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

Method httpobjget

ais/target.go:936–958  ·  view source on GitHub ↗

httpobj* handlers // GET /v1/objects/ / Initially validates if the request is internal request (either from proxy or target) and calls getObject. Checks if the object exists locally (if not, downloads it) and sends it back If the bucket is in the Cloud one and ValidateWa

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

Source from the content-addressed store, hash-verified

934// If the bucket is in the Cloud one and ValidateWarmGet is enabled there is an extra
935// check whether the object exists locally. Version is checked as well if configured.
936func (t *target) httpobjget(w http.ResponseWriter, r *http.Request) {
937 apireq := apiReqAlloc(2, apc.URLPathObjects.L, true /*dpq*/)
938 if err := t.parseReq(w, r, apireq); err != nil {
939 apiReqFree(apireq)
940 return
941 }
942 if err := apireq.dpq.fromRawQ(r.URL.RawQuery); err != nil {
943 debug.AssertNoErr(err)
944 t.writeErr(w, r, err)
945 return
946 }
947 if cmn.Features.IsSet(feat.EnforceIntraClusterAccess) {
948 if apireq.dpq.ptime == "" /*isRedirect*/ && t.isIntraCall(r.Header, false /*from primary*/) != nil {
949 t.writeErrf(w, r, "%s: %s(obj) is expected to be redirected (remaddr=%s)",
950 t.si, r.Method, r.RemoteAddr)
951 return
952 }
953 }
954 lom := cluster.AllocLOM(apireq.items[1])
955 lom = t.getObject(w, r, apireq.dpq, apireq.bck, lom)
956 cluster.FreeLOM(lom)
957 apiReqFree(apireq)
958}
959
960// getObject is main function to get the object. It doesn't check request origin,
961// so it must be done by the caller (if necessary).

Callers 1

objectHandlerMethod · 0.95

Calls 12

getObjectMethod · 0.95
AssertNoErrFunction · 0.92
AllocLOMFunction · 0.92
FreeLOMFunction · 0.92
apiReqAllocFunction · 0.85
apiReqFreeFunction · 0.85
parseReqMethod · 0.80
fromRawQMethod · 0.80
writeErrMethod · 0.80
isIntraCallMethod · 0.80
writeErrfMethod · 0.80
IsSetMethod · 0.45

Tested by

no test coverage detected