-
Notifications
You must be signed in to change notification settings - Fork 178
/
buffer.go
41 lines (28 loc) · 1.19 KB
/
buffer.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
33
34
35
36
37
38
39
40
41
package module
import (
"github.com/onflow/flow-go/model/cluster"
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/model/messages"
)
// PendingBlockBuffer defines an interface for a cache of pending blocks that
// cannot yet be processed because they do not connect to the rest of the chain
// state. They are indexed by parent ID to enable processing all of a parent's
// children once the parent is received.
type PendingBlockBuffer interface {
Add(originID flow.Identifier, proposal *messages.BlockProposal) bool
ByID(blockID flow.Identifier) (*flow.PendingBlock, bool)
ByParentID(parentID flow.Identifier) ([]*flow.PendingBlock, bool)
DropForParent(parentID flow.Identifier)
PruneByHeight(height uint64)
Size() uint
}
// PendingClusterBlockBuffer is the same thing as PendingBlockBuffer, but for
// collection node cluster consensus.
type PendingClusterBlockBuffer interface {
Add(originID flow.Identifier, proposal *messages.ClusterBlockProposal) bool
ByID(blockID flow.Identifier) (*cluster.PendingBlock, bool)
ByParentID(parentID flow.Identifier) ([]*cluster.PendingBlock, bool)
DropForParent(parentID flow.Identifier)
PruneByHeight(height uint64)
Size() uint
}