// New returns a new JobStore backed by the Datastore.
New returns a new JobStore backed by the Datastore.
// New returns a new JobStore backed by the Datastore .
func New(ds datastore.Datastore) (*Store, error) {
	s := &Store{
		ds:                 ds,
		jobStatusCache:     make(map[ffs.APIID]map[cid.Cid]map[cid.Cid]deals.StorageDealInfo),
		queuedJobs:         make(map[ffs.APIID]map[cid.Cid][]*ffs.StorageJob),
		executingJobs:      make(map[ffs.APIID]map[cid.Cid]*ffs.StorageJob),
		lastFinalJobs:      make(map[ffs.APIID]map[cid.Cid]*ffs.StorageJob),
		lastSuccessfulJobs: make(map[ffs.APIID]map[cid.Cid]*ffs.StorageJob),
	}
	if err := s.loadCaches(); err != nil {
		return nil, fmt.Errorf("reloading caches: %s", err)
	}
	return s, nil
}
func New ( ds datastore . Datastore ) ( * Store , error ) { s := & Store { ds : ds , jobStatusCache : make ( map [ ffs . APIID ] map [ cid . Cid ] map [ cid . Cid ] deals . StorageDealInfo ) , queuedJobs : make ( map [ ffs . APIID ] map [ cid . Cid ] [ ] * ffs . StorageJob ) , executingJobs : make ( map [ ffs . APIID ] map [ cid . Cid ] * ffs . StorageJob ) , lastFinalJobs : make ( map [ ffs . APIID ] map [ cid . Cid ] * ffs . StorageJob ) , lastSuccessfulJobs : make ( map [ ffs . APIID ] map [ cid . Cid ] * ffs . StorageJob ) , } if err := s . loadCaches ( ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } return s , nil }
New returns a new JobStore backed by the Datastore.
New returns a new JobStore backed by the Datastore .