github.com/MetalBlockchain/metalgo@v1.11.9/snow/consensus/snowman/poll/interfaces.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package poll 5 6 import ( 7 "fmt" 8 9 "github.com/MetalBlockchain/metalgo/ids" 10 "github.com/MetalBlockchain/metalgo/utils/bag" 11 "github.com/MetalBlockchain/metalgo/utils/formatting" 12 ) 13 14 // Set is a collection of polls 15 type Set interface { 16 fmt.Stringer 17 18 Add(requestID uint32, vdrs bag.Bag[ids.NodeID]) bool 19 Vote(requestID uint32, vdr ids.NodeID, vote ids.ID) []bag.Bag[ids.ID] 20 Drop(requestID uint32, vdr ids.NodeID) []bag.Bag[ids.ID] 21 Len() int 22 } 23 24 // Poll is an outstanding poll 25 type Poll interface { 26 formatting.PrefixedStringer 27 28 Vote(vdr ids.NodeID, vote ids.ID) 29 Drop(vdr ids.NodeID) 30 Finished() bool 31 Result() bag.Bag[ids.ID] 32 } 33 34 // Factory creates a new Poll 35 type Factory interface { 36 New(vdrs bag.Bag[ids.NodeID]) Poll 37 }