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

Method getNextObjs

downloader/job.go:388–426  ·  view source on GitHub ↗

Reads the content of a remote bucket page by page until any objects to download found or the bucket list is over.

()

Source from the content-addressed store, hash-verified

386// Reads the content of a remote bucket page by page until any objects to
387// download found or the bucket list is over.
388func (j *backendDlJob) getNextObjs() error {
389 var (
390 sid = j.t.SID()
391 smap = j.t.Sowner().Get()
392 backend = j.t.Backend(j.bck)
393 )
394 j.objs = j.objs[:0]
395 for len(j.objs) < downloadBatchSize {
396 msg := &apc.ListObjsMsg{
397 Prefix: j.prefix,
398 ContinuationToken: j.continuationToken,
399 PageSize: backend.MaxPageSize(),
400 }
401 bckList, _, err := backend.ListObjects(j.bck, msg)
402 if err != nil {
403 return err
404 }
405 j.continuationToken = bckList.ContinuationToken
406
407 for _, entry := range bckList.Entries {
408 if !j.checkObj(entry.Name) {
409 continue
410 }
411 obj, err := makeDlObj(smap, sid, j.bck, entry.Name, "")
412 if err != nil {
413 if err == errInvalidTarget {
414 continue
415 }
416 return err
417 }
418 j.objs = append(j.objs, obj)
419 }
420 if j.continuationToken == "" {
421 j.done = true
422 break
423 }
424 }
425 return nil
426}
427
428/////////////////////
429// downloadJobInfo //

Callers 1

genNextMethod · 0.95

Calls 8

checkObjMethod · 0.95
makeDlObjFunction · 0.85
SIDMethod · 0.65
GetMethod · 0.65
SownerMethod · 0.65
BackendMethod · 0.65
MaxPageSizeMethod · 0.65
ListObjectsMethod · 0.65

Tested by

no test coverage detected