MCPcopy Index your code
hub / github.com/NVIDIA/aistore / GetObjectReader

Function GetObjectReader

api/object.go:291–313  ·  view source on GitHub ↗

GetObjectReader returns reader of the requested object. It does not read body bytes, nor validates a checksum. Caller is responsible for closing the reader.

(baseParams BaseParams, bck cmn.Bck, object string, options ...GetObjectInput)

Source from the content-addressed store, hash-verified

289// GetObjectReader returns reader of the requested object. It does not read body
290// bytes, nor validates a checksum. Caller is responsible for closing the reader.
291func GetObjectReader(baseParams BaseParams, bck cmn.Bck, object string, options ...GetObjectInput) (r io.ReadCloser, err error) {
292 var (
293 q url.Values
294 hdr http.Header
295 )
296 if len(options) != 0 {
297 var w io.Writer
298 w, q, hdr = getObjectOptParams(options[0])
299 cos.Assert(w == nil)
300 }
301 q = bck.AddToQuery(q)
302 baseParams.Method = http.MethodGet
303 reqParams := AllocRp()
304 {
305 reqParams.BaseParams = baseParams
306 reqParams.Path = apc.URLPathObjects.Join(bck.Name, object)
307 reqParams.Query = q
308 reqParams.Header = hdr
309 }
310 r, err = reqParams.doReader()
311 FreeRp(reqParams)
312 return
313}
314
315// GetObjectWithValidation has same behavior as GetObject, but performs checksum
316// validation of the object by comparing the checksum in the response header

Callers 2

GetObjMethod · 0.92
GetObjReaderMethod · 0.92

Calls 7

AssertFunction · 0.92
getObjectOptParamsFunction · 0.85
AllocRpFunction · 0.85
FreeRpFunction · 0.85
JoinMethod · 0.80
doReaderMethod · 0.80
AddToQueryMethod · 0.45

Tested by

no test coverage detected