-
Notifications
You must be signed in to change notification settings - Fork 179
/
chunk_data_packs.go
32 lines (24 loc) · 1.04 KB
/
chunk_data_packs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package mempool
import (
"github.com/onflow/flow-go/model/flow"
)
// ChunkDataPacks represents a concurrency-safe memory pool for chunk data packs.
type ChunkDataPacks interface {
// Has checks whether the ChunkDataPack with the given chunkID is currently in
// the memory pool.
Has(chunkID flow.Identifier) bool
// Add will add the given chunk datapack to the memory pool. It will return
// false if it was already in the mempool.
Add(cdp *flow.ChunkDataPack) bool
// Remove will remove the given ChunkDataPack from the memory pool; it will
// return true if the ChunkDataPack was known and removed.
Remove(chunkID flow.Identifier) bool
// ByChunkID retrieve the chunk datapacke with the given chunk ID from the memory
// pool. It will return false if it was not found in the mempool.
ByChunkID(chunkID flow.Identifier) (*flow.ChunkDataPack, bool)
// Size will return the current size of the memory pool.
Size() uint
// All will retrieve all ChunkDataPacks that are currently in the memory pool
// as a slice.
All() []*flow.ChunkDataPack
}