forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 4
/
poll.go
23 lines (19 loc) · 866 Bytes
/
poll.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package bootstrapper
import (
"context"
"github.com/MetalBlockchain/metalgo/ids"
"github.com/MetalBlockchain/metalgo/utils/set"
)
type Poll interface {
// GetPeers returns the set of peers whose opinion should be requested. It
// is expected to repeatedly call this function along with [RecordOpinion]
// until [Result] returns finalized.
GetPeers(ctx context.Context) (peers set.Set[ids.NodeID])
// RecordOpinion of a node whose opinion was requested.
RecordOpinion(ctx context.Context, nodeID ids.NodeID, blkIDs set.Set[ids.ID]) error
// Result returns the evaluation of all the peer's opinions along with a
// flag to identify that the result has finished being calculated.
Result(ctx context.Context) (blkIDs []ids.ID, finalized bool)
}