github.com/koko1123/flow-go-1@v0.29.6/module/id_provider.go (about) 1 package module 2 3 import ( 4 "github.com/libp2p/go-libp2p/core/peer" 5 6 "github.com/koko1123/flow-go-1/model/flow" 7 ) 8 9 // IdentifierProvider provides an interface to get a list of Identifiers representing 10 // a specific set of nodes in the network. 11 type IdentifierProvider interface { 12 Identifiers() flow.IdentifierList 13 } 14 15 // IdentityProvider provides an interface to get a list of Identities representing 16 // the set of participants in the Flow protocol. CAUTION: return values will include 17 // ejected nodes, so callers must check the `Identity.Ejected` flag. 18 type IdentityProvider interface { 19 // Identities returns the full identities of _all_ nodes currently known to the 20 // protocol that pass the provided filter. Caution, this includes ejected nodes. 21 // Please check the `Ejected` flag in the identities (or provide a filter for 22 // removing ejected nodes). 23 Identities(flow.IdentityFilter) flow.IdentityList 24 25 // ByNodeID returns the full identity for the node with the given Identifier, 26 // where Identifier is the way the protocol refers to the node. The function 27 // has the same semantics as a map lookup, where the boolean return value is 28 // true if and only if Identity has been found, i.e. `Identity` is not nil. 29 // Caution: function returns include ejected nodes. Please check the `Ejected` 30 // flag in the identity. 31 ByNodeID(flow.Identifier) (*flow.Identity, bool) 32 33 // ByPeerID returns the full identity for the node with the given peer ID, 34 // where ID is the way the libP2P refers to the node. The function 35 // has the same semantics as a map lookup, where the boolean return value is 36 // true if and only if Identity has been found, i.e. `Identity` is not nil. 37 // Caution: function returns include ejected nodes. Please check the `Ejected` 38 // flag in the identity. 39 ByPeerID(peer.ID) (*flow.Identity, bool) 40 }