github.com/koko1123/flow-go-1@v0.29.6/module/buffer.go (about) 1 package module 2 3 import ( 4 "github.com/koko1123/flow-go-1/model/cluster" 5 "github.com/koko1123/flow-go-1/model/flow" 6 ) 7 8 // PendingBlockBuffer defines an interface for a cache of pending blocks that 9 // cannot yet be processed because they do not connect to the rest of the chain 10 // state. They are indexed by parent ID to enable processing all of a parent's 11 // children once the parent is received. 12 type PendingBlockBuffer interface { 13 Add(originID flow.Identifier, block *flow.Block) bool 14 15 ByID(blockID flow.Identifier) (flow.Slashable[flow.Block], bool) 16 17 ByParentID(parentID flow.Identifier) ([]flow.Slashable[flow.Block], bool) 18 19 DropForParent(parentID flow.Identifier) 20 21 // PruneByView prunes any pending blocks with views less or equal to the given view. 22 PruneByView(view uint64) 23 24 Size() uint 25 } 26 27 // PendingClusterBlockBuffer is the same thing as PendingBlockBuffer, but for 28 // collection node cluster consensus. 29 type PendingClusterBlockBuffer interface { 30 Add(originID flow.Identifier, block *cluster.Block) bool 31 32 ByID(blockID flow.Identifier) (flow.Slashable[cluster.Block], bool) 33 34 ByParentID(parentID flow.Identifier) ([]flow.Slashable[cluster.Block], bool) 35 36 DropForParent(parentID flow.Identifier) 37 38 // PruneByView prunes any pending cluster blocks with views less or equal to the given view. 39 PruneByView(view uint64) 40 41 Size() uint 42 }