Documentation
¶
Index ¶
- Constants
- func ChannelConsensusCluster(clusterID flow.ChainID) network.Channel
- func ChannelSyncCluster(clusterID flow.ChainID) network.Channel
- func Channels() network.ChannelList
- func ChannelsByRole(role flow.Role) network.ChannelList
- func ClusterChannel(channel network.Channel) (network.Channel, bool)
- func Exists(channel network.Channel) bool
- func IsDuplicatedEntryError(err error) bool
- func IsInvalidInputError(err error) bool
- func IsOutdatedInputError(err error) bool
- func IsUnverifiableInputError(err error) bool
- func LogError(log zerolog.Logger, err error)
- func LogErrorWithMsg(log zerolog.Logger, msg string, err error)
- func NewDuplicatedEntryErrorf(msg string, args ...interface{}) error
- func NewInvalidInputError(msg string) error
- func NewInvalidInputErrorf(msg string, args ...interface{}) error
- func NewOutdatedInputErrorf(msg string, args ...interface{}) error
- func NewUnverifiableInputError(msg string, args ...interface{}) error
- func RolesByChannel(channel network.Channel) (flow.RoleList, bool)
- func TopicFromChannel(channel network.Channel, rootBlockID string) network.Topic
- func UniqueChannels(channels network.ChannelList) network.ChannelList
- type DuplicatedEntryError
- type InvalidInputError
- type OutdatedInputError
- type Unit
- func (u *Unit) Ctx() context.Context
- func (u *Unit) Do(f func() error) error
- func (u *Unit) Done(actions ...func()) <-chan struct{}
- func (u *Unit) Launch(f func())
- func (u *Unit) LaunchAfter(delay time.Duration, f func())
- func (u *Unit) LaunchPeriodically(f func(), interval time.Duration, delay time.Duration)
- func (u *Unit) Quit() <-chan struct{}
- func (u *Unit) Ready(checks ...func()) <-chan struct{}
- type UnverifiableInputError
Constants ¶
const ( // Channels used for testing TestNetwork = network.Channel("test-network") TestMetrics = network.Channel("test-metrics") // Channels for consensus protocols ConsensusCommittee = network.Channel("consensus-committee") // Channels for protocols actively synchronizing state across nodes SyncCommittee = network.Channel("sync-committee") SyncExecution = network.Channel("sync-execution") // Channels for actively pushing entities to subscribers PushTransactions = network.Channel("push-transactions") PushGuarantees = network.Channel("push-guarantees") PushBlocks = network.Channel("push-blocks") PushReceipts = network.Channel("push-receipts") PushApprovals = network.Channel("push-approvals") // Channels for actively requesting missing entities RequestCollections = network.Channel("request-collections") RequestChunks = network.Channel("request-chunks") RequestReceiptsByBlockID = network.Channel("request-receipts-by-block-id") RequestApprovalsByChunk = network.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 )
channels
Variables ¶
This section is empty.
Functions ¶
func ChannelConsensusCluster ¶ added in v0.9.6
ChannelConsensusCluster returns a dynamic cluster consensus channel based on the chain ID of the cluster in question.
func ChannelSyncCluster ¶ added in v0.9.6
ChannelSyncCluster returns a dynamic cluster sync channel based on the chain ID of the cluster in question.
func Channels ¶ added in v0.14.0
func Channels() network.ChannelList
Channels returns all channels that nodes of any role have subscribed to.
func ChannelsByRole ¶ added in v0.14.0
func ChannelsByRole(role flow.Role) network.ChannelList
ChannelsByRole returns a list of all channels the role subscribes to.
func ClusterChannel ¶ added in v0.14.0
ClusterChannel returns true if channel is cluster-based. At the current implementation, only collection nodes are involved in a cluster-based channels. If the channel is a cluster-based one, this method also strips off the channel prefix and returns it.
func Exists ¶ added in v0.14.0
Exists returns true if channel exists in channelRoleMap. At the current state, any developer-defined channel should be added to channelRoleMap as a constant channel type manually.
func IsDuplicatedEntryError ¶ added in v0.14.0
func IsInvalidInputError ¶
IsInvalidInputError returns whether the given error is an InvalidInputError error
func IsOutdatedInputError ¶
func IsUnverifiableInputError ¶ added in v0.15.0
func LogErrorWithMsg ¶ added in v0.15.0
func NewDuplicatedEntryErrorf ¶ added in v0.14.0
func NewInvalidInputError ¶
func NewInvalidInputErrorf ¶
func NewOutdatedInputErrorf ¶
func NewUnverifiableInputError ¶ added in v0.15.0
func RolesByChannel ¶ added in v0.14.0
RolesByChannel returns list of flow roles involved in the channel.
func TopicFromChannel ¶ added in v0.14.0
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 UniqueChannels ¶ added in v0.14.0
func UniqueChannels(channels network.ChannelList) network.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.
Types ¶
type DuplicatedEntryError ¶ added in v0.14.0
type DuplicatedEntryError struct {
// contains filtered or unexported fields
}
func (DuplicatedEntryError) Error ¶ added in v0.14.0
func (e DuplicatedEntryError) Error() string
func (DuplicatedEntryError) Unwrap ¶ added in v0.14.0
func (e DuplicatedEntryError) Unwrap() error
type InvalidInputError ¶
type InvalidInputError struct {
// contains filtered or unexported fields
}
InvalidInputError are errors for caused by invalid inputs. It's useful to distinguish these known errors from exceptions. By distinguishing errors from exceptions, we can log them differently. For instance, log InvalidInputError error as a warn log, and log other error as an error log.
func (InvalidInputError) Error ¶
func (e InvalidInputError) Error() string
func (InvalidInputError) Unwrap ¶
func (e InvalidInputError) Unwrap() error
type OutdatedInputError ¶
type OutdatedInputError struct {
// contains filtered or unexported fields
}
OutdatedInputError are for inputs that are outdated. An outdated input doesn't mean whether the input was invalid or not, knowing that would take more computation that isn't necessary. An outdated input could also for a duplicated input: the duplication is outdated.
func (OutdatedInputError) Error ¶
func (e OutdatedInputError) Error() string
func (OutdatedInputError) Unwrap ¶
func (e OutdatedInputError) Unwrap() error
type Unit ¶
type Unit struct { sync.Mutex // can be used to synchronize the engine // contains filtered or unexported fields }
Unit handles synchronization management, startup, and shutdown for engines.
func (*Unit) Ctx ¶
Ctx returns a context with the same lifecycle scope as the unit. In particular, it is cancelled when Done is called, so it can be used as the parent context for processes spawned by any engine whose lifecycle is managed by a unit.
func (*Unit) Do ¶
Do synchronously executes the input function f unless the unit has shut down. It returns the result of f. If f is executed, the unit will not shut down until after f returns.
func (*Unit) Done ¶
func (u *Unit) Done(actions ...func()) <-chan struct{}
Done returns a channel that is closed when the unit is done. A unit is done when (i) the series of "action" functions are executed and (ii) all pending functions invoked with `Do` or `Launch` have completed.
The engine using the unit is responsible for defining these action functions as required.
func (*Unit) Launch ¶
func (u *Unit) Launch(f func())
Launch asynchronously executes the input function unless the unit has shut down. If f is executed, the unit will not shut down until after f returns.
func (*Unit) LaunchAfter ¶
LaunchAfter asynchronously executes the input function after a certain delay unless the unit has shut down.
func (*Unit) LaunchPeriodically ¶
LaunchPeriodically asynchronously executes the input function on `interval` periods unless the unit has shut down. If f is executed, the unit will not shut down until after f returns.
type UnverifiableInputError ¶ added in v0.15.0
type UnverifiableInputError struct {
// contains filtered or unexported fields
}
UnverifiableInputError are for inputs that cannot be verified at this moment. Usually it means that we don't have enough data to verify it. A good example is missing data in DB to process input.
func (UnverifiableInputError) Error ¶ added in v0.15.0
func (e UnverifiableInputError) Error() string
func (UnverifiableInputError) Unwrap ¶ added in v0.15.0
func (e UnverifiableInputError) Unwrap() error
Directories
¶
Path | Synopsis |
---|---|
access
|
|
collection
|
|
ingest
Package ingest implements an engine for receiving transactions that need to be packaged into a collection.
|
Package ingest implements an engine for receiving transactions that need to be packaged into a collection. |
pusher
Package pusher implements an engine for providing access to resources held by the collection node, including collections, collection guarantees, and transactions.
|
Package pusher implements an engine for providing access to resources held by the collection node, including collections, collection guarantees, and transactions. |
common
|
|
consensus
|
|
ghost
|
|
verification
|
|