channels

package
v0.29.0-stable-cadence-3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2022 License: AGPL-3.0 Imports: 5 Imported by: 9

Documentation

Index

Constants

View Source
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

func ChannelExists(channel Channel) bool

ChannelExists returns true if the channel exists.

func ClusterChannelPrefix

func ClusterChannelPrefix(clusterChannel Channel) (string, bool)

ClusterChannelPrefix returns the cluster channel prefix and true if clusterChannel exists inclusterChannelPrefixRoleMap

func ClusterChannelRoles

func ClusterChannelRoles(clusterChannel Channel) flow.RoleList

ClusterChannelRoles returns the list of roles that are involved in the given cluster-based channel.

func IsClusterChannel

func IsClusterChannel(channel Channel) bool

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

func IsPublicChannel(channel Channel) bool

IsPublicChannel returns true if channel is in the public channels list

func RolesByChannel

func RolesByChannel(channel Channel) (flow.RoleList, bool)

RolesByChannel returns list of flow roles involved in the channel. If the given channel is a public channel, the returned list will contain all roles.

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 ChannelFromTopic(topic Topic) (Channel, bool)

func ConsensusCluster

func ConsensusCluster(clusterID flow.ChainID) Channel

ConsensusCluster returns a dynamic cluster consensus channel based on the chain ID of the cluster in question.

func SyncCluster

func SyncCluster(clusterID flow.ChainID) Channel

SyncCluster returns a dynamic cluster sync channel based on the chain ID of the cluster in question.

func (Channel) String

func (c Channel) String() string

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 returns true if the ChannelList contains the given channel.

func (ChannelList) ExcludeChannels added in v0.28.0

func (cl ChannelList) ExcludeChannels(other ChannelList) ChannelList

ExcludeChannels returns list of channels that are in the ChannelList but not in the other list.

func (ChannelList) ExcludePattern added in v0.28.0

func (cl ChannelList) ExcludePattern(regexp *regexp.Regexp) ChannelList

ExcludePattern returns a new ChannelList excluding the Channels that satisfy the given predicate.

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) String added in v0.28.0

func (cl ChannelList) String() []string

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.

func TopicsFromChannels added in v0.28.0

func TopicsFromChannels(channels ChannelList, rootBlockID flow.Identifier) []Topic

TopicsFromChannels returns the unique LibP2P topics form the channels.

func (Topic) String

func (t Topic) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL