// QueuedJobs returns queued jobs for the specified instance id and cids.
// If the instance id is ffs.EmptyInstanceID, data for all instances is returned.
// If no cids are provided, data for all data cids is returned.
QueuedJobs returns queued jobs for the specified instance id and cids.
If the instance id is ffs.EmptyInstanceID, data for all instances is returned.
If no cids are provided, data for all data cids is returned.
// QueuedJobs returns queued jobs for the specified instance id and cids . // If the instance id is ffs . EmptyInstanceID data for all instances is returned . // If no cids are provided data for all data cids is returned .
func (s *Store) QueuedJobs(iid ffs.APIID, cids ...cid.Cid) []ffs.StorageJob {
	s.lock.Lock()
	defer s.lock.Unlock()
	var iids []ffs.APIID
	if iid == ffs.EmptyInstanceID {
		for iid := range s.queuedJobs {
			iids = append(iids, iid)
		}
	} else {
		iids = append(iids, iid)
		ensureJobsSliceMap(s.queuedJobs, iid)
	}
	var res []ffs.StorageJob
	for _, iid := range iids {
		cidsList := cids
		if len(cidsList) == 0 {
			for cid := range s.queuedJobs[iid] {
				cidsList = append(cidsList, cid)
			}
		}
		for _, cid := range cidsList {
			jobs := s.queuedJobs[iid][cid]
			for _, job := range jobs {
				res = append(res, *job)
			}
		}
	}
	sort.Slice(res, func(a, b int) bool {
		return res[a].CreatedAt < res[b].CreatedAt
	})
	return res
}
func ( s * Store ) QueuedJobs ( iid ffs . APIID , cids ... cid . Cid ) [ ] ffs . StorageJob { s . lock . Lock ( ) defer s . lock . Unlock ( ) var iids [ ] ffs . APIID if iid == ffs . EmptyInstanceID { for iid := range s . queuedJobs { iids = append ( iids , iid ) } } else { iids = append ( iids , iid ) ensureJobsSliceMap ( s . queuedJobs , iid ) } var res [ ] ffs . StorageJob for _ , iid := range iids { cidsList := cids if len ( cidsList ) == 0 { for cid := range s . queuedJobs [ iid ] { cidsList = append ( cidsList , cid ) } } for _ , cid := range cidsList { jobs := s . queuedJobs [ iid ] [ cid ] for _ , job := range jobs { res = append ( res , * job ) } } } sort . Slice ( res , func ( a , b int ) bool { return res [ a ] . CreatedAt < res [ b ] . CreatedAt } ) return res }
QueuedJobs returns queued jobs for the specified instance id and cids.
QueuedJobs returns queued jobs for the specified instance id and cids .