Documentation ¶
Index ¶
- Constants
- func ChannelExists(channel Channel) bool
- func ClusterChannelPrefix(clusterChannel Channel) (string, bool)
- func ClusterChannelRoles(clusterChannel Channel) flow.RoleList
- func IsClusterChannel(channel Channel) bool
- func IsPublicChannel(channel Channel) bool
- func RolesByChannel(channel Channel) (flow.RoleList, bool)
- type Channel
- type ChannelList
- type Topic
Constants ¶
const ( // Channels used for testing TestNetworkChannel = Channel("test-network") TestMetricsChannel = Channel("test-metrics") // Channels for consensus protocols ConsensusCommittee = Channel("consensus-committee") ConsensusClusterPrefix = "consensus-cluster" // dynamic channel, use ConsensusCluster function // Channels for protocols actively synchronizing state across nodes SyncCommittee = Channel("sync-committee") SyncClusterPrefix = "sync-cluster" // dynamic channel, use SyncCluster function SyncExecution = Channel("sync-execution") // Channels for dkg communication DKGCommittee = "dkg-committee" // Channels for actively pushing entities to subscribers PushTransactions = Channel("push-transactions") PushGuarantees = Channel("push-guarantees") PushBlocks = Channel("push-blocks") PushReceipts = Channel("push-receipts") PushApprovals = Channel("push-approvals") // Channels for actively requesting missing entities RequestCollections = Channel("request-collections") RequestChunks = Channel("request-chunks") RequestReceiptsByBlockID = Channel("request-receipts-by-block-id") RequestApprovalsByChunk = Channel("request-approvals-by-chunk") // Channel aliases to make the code more readable / more robust to errors ReceiveTransactions = PushTransactions ReceiveGuarantees = PushGuarantees ReceiveBlocks = PushBlocks ReceiveReceipts = PushReceipts ReceiveApprovals = PushApprovals ProvideCollections = RequestCollections ProvideChunks = RequestChunks ProvideReceiptsByBlockID = RequestReceiptsByBlockID ProvideApprovalsByChunk = RequestApprovalsByChunk // Public network channels PublicPushBlocks = Channel("public-push-blocks") PublicReceiveBlocks = PublicPushBlocks PublicSyncCommittee = Channel("public-sync-committee") // Execution data service ExecutionDataService = Channel("execution-data-service") )
channels
Variables ¶
This section is empty.
Functions ¶
func ChannelExists ¶
ChannelExists returns true if the channel exists.
func ClusterChannelPrefix ¶
ClusterChannelPrefix returns the cluster channel prefix and true if clusterChannel exists inclusterChannelPrefixRoleMap
func ClusterChannelRoles ¶
ClusterChannelRoles returns the list of roles that are involved in the given cluster-based channel.
func IsClusterChannel ¶
IsClusterChannel returns true if channel is cluster-based. Currently, only collection nodes are involved in a cluster-based channels.
func IsPublicChannel ¶ added in v0.27.3
IsPublicChannel returns true if channel is in the public channels list
Types ¶
type Channel ¶
type Channel string
Channel specifies a virtual and isolated communication medium. Nodes subscribed to the same channel can disseminate epidemic messages among each other, i.e: multicast and publish.
func ChannelFromTopic ¶
func ConsensusCluster ¶
ConsensusCluster returns a dynamic cluster consensus channel based on the chain ID of the cluster in question.
func SyncCluster ¶
SyncCluster returns a dynamic cluster sync channel based on the chain ID of the cluster in question.
type ChannelList ¶
type ChannelList []Channel
func Channels ¶
func Channels() ChannelList
Channels returns all channels that nodes of any role have subscribed to (except cluster-based channels).
func ChannelsByRole ¶
func ChannelsByRole(role flow.Role) ChannelList
ChannelsByRole returns a list of all channels the role subscribes to (except cluster-based channels and public channels).
func PublicChannels ¶
func PublicChannels() ChannelList
PublicChannels returns all channels that are used on the public network.
func UniqueChannels ¶
func UniqueChannels(channels ChannelList) ChannelList
UniqueChannels returns list of non-cluster channels with a unique RoleList accompanied with the list of all cluster channels. e.g. if channel X and Y both are non-cluster channels and have role IDs [A,B,C] then only one of them will be in the returned list.
func (ChannelList) Contains ¶
func (cl ChannelList) Contains(channel Channel) bool
Contains retuns true if the ChannelList contains the given channel.
func (ChannelList) ID ¶
func (cl ChannelList) ID() flow.Identifier
ID returns hash of the content of ChannelList. It first sorts the ChannelList and then takes its hash value.
func (ChannelList) Len ¶
func (cl ChannelList) Len() int
Len returns length of the ChannelList in the number of stored Channels. It satisfies the sort.Interface making the ChannelList sortable.
func (ChannelList) Less ¶
func (cl ChannelList) Less(i, j int) bool
Less returns true if element i in the ChannelList is less than j based on the numerical value of its Channel. Otherwise it returns true. It satisfies the sort.Interface making the ChannelList sortable.
func (ChannelList) Swap ¶
func (cl ChannelList) Swap(i, j int)
Swap swaps the element i and j in the ChannelList. It satisfies the sort.Interface making the ChannelList sortable.
type Topic ¶
type Topic string
Topic is the internal type of Libp2p which corresponds to the Channel in the network level. It is a virtual medium enabling nodes to subscribe and communicate over epidemic dissemination.
func TopicFromChannel ¶
func TopicFromChannel(channel Channel, rootBlockID flow.Identifier) Topic
TopicFromChannel returns the unique LibP2P topic form the channel. The channel is made up of name string suffixed with root block id. The root block id is used to prevent cross talks between nodes on different sporks.