github.com/koko1123/flow-go-1@v0.29.6/engine/verification/fetcher/chunkconsumer/jobs.go (about) 1 package chunkconsumer 2 3 import ( 4 "fmt" 5 6 "github.com/koko1123/flow-go-1/module" 7 "github.com/koko1123/flow-go-1/storage" 8 ) 9 10 // ChunkJobs wraps the storage layer to provide an abstraction for consumers to read jobs. 11 type ChunkJobs struct { 12 locators storage.ChunksQueue 13 } 14 15 func (j *ChunkJobs) AtIndex(index uint64) (module.Job, error) { 16 locator, err := j.locators.AtIndex(index) 17 if err != nil { 18 return nil, fmt.Errorf("could not read chunk: %w", err) 19 } 20 return ChunkLocatorToJob(locator), nil 21 } 22 23 func (j *ChunkJobs) Head() (uint64, error) { 24 return j.locators.LatestIndex() 25 }