MCPcopy
hub / github.com/minio/minio-go / doGetRequest

Method doGetRequest

api-get-object.go:327–360  ·  view source on GitHub ↗

doGetRequest - sends and blocks on the firstReqCh and reqCh of an object. Returns back the size of the buffer read, if anything was read, as well as any error encountered. For all first requests sent on the object it is also responsible for sending back the objectInfo.

(request getRequest)

Source from the content-addressed store, hash-verified

325// as any error encountered. For all first requests sent on the object
326// it is also responsible for sending back the objectInfo.
327func (o *Object) doGetRequest(request getRequest) (getResponse, error) {
328 select {
329 case <-o.ctx.Done():
330 return getResponse{}, o.ctx.Err()
331 case o.reqCh <- request:
332 }
333
334 response := <-o.resCh
335
336 // Return any error to the top level.
337 if response.Error != nil && response.Error != io.EOF {
338 return response, response.Error
339 }
340
341 // This was the first request.
342 if !o.isStarted {
343 // The object has been operated on.
344 o.isStarted = true
345 }
346 // Set the objectInfo if the request was not readAt
347 // and it hasn't been set before.
348 if !o.objectInfoSet && !request.isReadAt {
349 o.objectInfo = response.objectInfo
350 o.objectInfoSet = true
351 }
352 // Set beenRead only if it has not been set before.
353 if !o.beenRead {
354 o.beenRead = response.didRead
355 }
356 // Data are ready on the wire, no need to reinitiate connection in lower level
357 o.seekData = false
358
359 return response, response.Error
360}
361
362// setOffset - handles the setting of offsets for
363// Read/ReadAt/Seek requests.

Callers 4

ReadMethod · 0.95
StatMethod · 0.95
ReadAtMethod · 0.95
SeekMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected