github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/mempool/assignments.go (about) 1 package mempool 2 3 import ( 4 chunkmodels "github.com/onflow/flow-go/model/chunks" 5 "github.com/onflow/flow-go/model/flow" 6 ) 7 8 // Assignments represents a concurrency-safe memory pool for chunk assignments 9 type Assignments interface { 10 11 // Has checks whether the Assignment with the given hash is currently in 12 // the memory pool. 13 Has(assignmentID flow.Identifier) bool 14 15 // Add will add the given assignment to the memory pool. It will return 16 // false if it was already in the mempool. 17 Add(assignmentFingerprint flow.Identifier, assignment *chunkmodels.Assignment) bool 18 19 // Remove will remove the given Assignment from the memory pool; it will 20 // return true if the Assignment was known and removed. 21 Remove(assignmentID flow.Identifier) bool 22 23 // ByID retrieve the chunk assigment with the given ID from the memory pool. 24 // It will return false if it was not found in the mempool. 25 ByID(assignmentID flow.Identifier) (*chunkmodels.Assignment, bool) 26 27 // Size will return the current size of the memory pool. 28 Size() uint 29 30 // All will retrieve all Assignments that are currently in the memory pool 31 // as a slice. 32 All() []*chunkmodels.Assignment 33 }