Documentation ¶
Index ¶
- Constants
- func CloseEventReporter()
- func EmitAtxPublished(nodeID types.NodeID, current, target types.EpochID, atxID types.ATXID, ...)
- func EmitBeacon(epoch types.EpochID, beacon types.Beacon)
- func EmitEligibilities(nodeID types.NodeID, epoch types.EpochID, beacon types.Beacon, ...)
- func EmitInitComplete(nodeID types.NodeID)
- func EmitInitFailure(nodeID types.NodeID, commitment types.ATXID, err error)
- func EmitInitStart(nodeID types.NodeID, commitment types.ATXID)
- func EmitInvalidPostProof(nodeID types.NodeID)
- func EmitOwnMalfeasanceProof(nodeID types.NodeID, mp *wire.MalfeasanceProof)
- func EmitPoetWaitProof(nodeID types.NodeID, publish types.EpochID, wait time.Time)
- func EmitPoetWaitRound(nodeID types.NodeID, current, publish types.EpochID, wait time.Time)
- func EmitPostComplete(nodeID types.NodeID, challenge []byte)
- func EmitPostFailure(nodeID types.NodeID)
- func EmitPostServiceStarted()
- func EmitPostServiceStopped()
- func EmitPostStart(nodeID types.NodeID, challenge []byte)
- func EmitProposal(nodeID types.NodeID, layer types.LayerID, proposal types.ProposalID)
- func EventHook() func(entry zapcore.Entry) error
- func InitializeReporter()
- func ReportAccountUpdate(a types.Address)
- func ReportError(err NodeError)
- func ReportLayerUpdate(layer LayerUpdate)
- func ReportMalfeasance(nodeID types.NodeID, mp *wire.MalfeasanceProof)
- func ReportNewActivation(activation *types.ActivationTx)
- func ReportNewTx(layerID types.LayerID, tx *types.Transaction)
- func ReportNodeStatusUpdate()
- func ReportProposal(status ProposalStatus, proposal *types.Proposal)
- func ReportResult(rst types.TransactionWithResult)
- func ReportRewardReceived(r types.Reward)
- func ReportTxWithValidity(layerID types.LayerID, tx *types.Transaction, valid bool)
- func SubscribeToLayers(ticker LayerClock)
- func SubscribeUserEvents(opts ...SubOpt) (*BufferedSubscription[UserEvent], *Ring[UserEvent], error)
- func ToMalfeasancePB(nodeID types.NodeID, mp *wire.MalfeasanceProof, includeProof bool) *pb.MalfeasanceProof
- type Account
- type ActivationTx
- type BufferedSubscription
- type EventMalfeasance
- type EventProposal
- type EventReporter
- type LayerClock
- type LayerUpdate
- type NodeError
- type ProposalStatus
- type Ring
- type Status
- type SubOpt
- type Subscription
- func SubscribeAccount() Subscription
- func SubscribeActivations() Subscription
- func SubscribeErrors() Subscription
- func SubscribeLayers() Subscription
- func SubscribeMalfeasance() Subscription
- func SubscribeProposals() Subscription
- func SubscribeRewards() Subscription
- func SubscribeStatus() Subscription
- func SubscribeTxs() Subscription
- type Transaction
- type TxReceipt
- type UserEvent
Constants ¶
const ( LayerStatusTypeUnknown = iota LayerStatusTypeApproved // approved by Hare LayerStatusTypeConfirmed // confirmed by Tortoise LayerStatusTypeApplied // applied to state )
The status of a layer TODO: this list is woefully inadequate and does not map to reality. See https://github.com/spacemeshos/api/issues/144.
Variables ¶
This section is empty.
Functions ¶
func CloseEventReporter ¶ added in v0.1.15
func CloseEventReporter()
CloseEventReporter shuts down the event reporting service and closes open channels.
func EmitAtxPublished ¶ added in v1.0.0
func EmitEligibilities ¶ added in v1.0.0
func EmitInitComplete ¶ added in v1.0.0
func EmitInitFailure ¶ added in v1.0.3
func EmitInitStart ¶ added in v1.0.0
func EmitInvalidPostProof ¶ added in v1.0.3
func EmitOwnMalfeasanceProof ¶ added in v1.1.0
func EmitOwnMalfeasanceProof(nodeID types.NodeID, mp *wire.MalfeasanceProof)
func EmitPoetWaitProof ¶ added in v1.0.0
func EmitPoetWaitRound ¶ added in v1.0.0
func EmitPostComplete ¶ added in v1.0.0
func EmitPostFailure ¶ added in v1.0.0
func EmitPostServiceStarted ¶ added in v1.3.0
func EmitPostServiceStarted()
func EmitPostServiceStopped ¶ added in v1.3.0
func EmitPostServiceStopped()
func EmitPostStart ¶ added in v1.0.0
func EmitProposal ¶ added in v1.0.0
func InitializeReporter ¶ added in v1.0.0
func InitializeReporter()
InitializeReporter initializes the event reporting interface with a nonzero channel buffer. This is useful for testing, where we want reporting to block.
func ReportAccountUpdate ¶ added in v0.1.15
ReportAccountUpdate reports an account whose data has been updated.
func ReportLayerUpdate ¶ added in v1.0.0
func ReportLayerUpdate(layer LayerUpdate)
ReportLayerUpdate reports a new layer, or an update to an existing layer.
func ReportMalfeasance ¶ added in v1.1.0
func ReportMalfeasance(nodeID types.NodeID, mp *wire.MalfeasanceProof)
ReportMalfeasance reports a malfeasance proof.
func ReportNewActivation ¶ added in v0.1.15
func ReportNewActivation(activation *types.ActivationTx)
ReportNewActivation reports a new activation.
func ReportNewTx ¶ added in v0.1.15
func ReportNewTx(layerID types.LayerID, tx *types.Transaction)
ReportNewTx dispatches incoming events to the reporter singleton.
func ReportNodeStatusUpdate ¶ added in v0.1.15
func ReportNodeStatusUpdate()
ReportNodeStatusUpdate reports an update to the node status. It just pings the listener to notify them that there is an update; the listener is responsible for fetching the new status details. This is because status contains disparate information coming from different services, and the listener already knows how to gather that information so there is no point in duplicating that logic here. Note: There is some overlap with channelLayer here, as a new latest or verified layer should be sent over that channel as well. However, that happens inside the Mesh, at the source. It doesn't currently happen here because the status update includes only a layer ID, not full layer data, and the Reporter currently has no way to retrieve full layer data.
func ReportProposal ¶ added in v1.0.0
func ReportProposal(status ProposalStatus, proposal *types.Proposal)
ReportProposal reports a proposal.
func ReportResult ¶ added in v1.0.0
func ReportResult(rst types.TransactionWithResult)
ReportResult reports creation or receipt of a new tx receipt.
func ReportRewardReceived ¶ added in v0.1.15
ReportRewardReceived reports a new reward.
func ReportTxWithValidity ¶ added in v0.1.15
func ReportTxWithValidity(layerID types.LayerID, tx *types.Transaction, valid bool)
ReportTxWithValidity reports a tx along with whether it was just invalidated.
func SubscribeToLayers ¶ added in v0.1.15
func SubscribeToLayers(ticker LayerClock)
SubscribeToLayers is used to track and report automatically every time a new layer is reached.
func SubscribeUserEvents ¶ added in v1.0.0
func ToMalfeasancePB ¶ added in v1.1.0
func ToMalfeasancePB(nodeID types.NodeID, mp *wire.MalfeasanceProof, includeProof bool) *pb.MalfeasanceProof
Types ¶
type ActivationTx ¶ added in v1.0.0
type ActivationTx struct {
*types.ActivationTx
}
ActivationTx wraps *types.ActivationTx.
type BufferedSubscription ¶ added in v1.0.0
type BufferedSubscription[T any] struct { // contains filtered or unexported fields }
BufferedSubscription is meant to be used by API subscribers.
Majority of the events are published on the critical consensus path, and they can't block consensus progress if consumer is slow. To account for slow consumer each subscription maintains an internal buffer with specific events, if this buffer overflows consumer should be dropped and stream restarted.
func Subscribe ¶ added in v1.0.0
func Subscribe[T any](opts ...SubOpt) (*BufferedSubscription[T], error)
Subscribe to the objects of type T.
func SubscribeMatched ¶ added in v1.0.0
func SubscribeMatched[T any](matcher func(*T) bool, opts ...SubOpt) (*BufferedSubscription[T], error)
SubscribeMatched subscribes and filters results before adding them to the Out channel.
func (*BufferedSubscription[T]) Close ¶ added in v1.0.0
func (sub *BufferedSubscription[T]) Close()
Close non-blocking close of the subscription.
func (*BufferedSubscription[T]) Full ¶ added in v1.0.0
func (sub *BufferedSubscription[T]) Full() <-chan struct{}
Full is closed if subscriptions buffer overflows.
func (*BufferedSubscription[T]) Out ¶ added in v1.0.0
func (sub *BufferedSubscription[T]) Out() <-chan T
Out is a channel with subscription results.
type EventMalfeasance ¶ added in v1.1.0
type EventMalfeasance struct { Smesher types.NodeID Proof *wire.MalfeasanceProof }
EventMalfeasance includes the malfeasance proof.
type EventProposal ¶ added in v1.0.0
type EventProposal struct { Status ProposalStatus Proposal *types.Proposal }
EventProposal includes proposal and proposal status.
type EventReporter ¶ added in v0.1.15
type EventReporter struct {
// contains filtered or unexported fields
}
EventReporter is the struct that receives incoming events and dispatches them.
type LayerClock ¶ added in v1.0.0
type LayerUpdate ¶ added in v1.0.0
LayerUpdate packages up a layer with its status (which a layer does not ordinarily contain).
func (LayerUpdate) Field ¶ added in v1.0.0
func (nl LayerUpdate) Field() log.Field
Field returns a log field. Implements the LoggableField interface.
type ProposalStatus ¶ added in v1.0.0
type ProposalStatus int
ProposalStatus is a type for proposal status.
const ( // ProposalCreated is a status of the proposal that was created. ProposalCreated ProposalStatus = iota // ProposalIncluded is a status of the proposal when it is included into the block. ProposalIncluded )
func (ProposalStatus) String ¶ added in v1.0.0
func (s ProposalStatus) String() string
type Ring ¶ added in v1.0.0
type Ring[T any] struct { // contains filtered or unexported fields }
Ring is an insert only buffer.
type SubOpt ¶ added in v1.0.0
type SubOpt func(*subconf)
SubOpt for changing subscribe options.
func WithBuffer ¶ added in v1.0.0
WithBuffer changes subscription buffer size.
type Subscription ¶ added in v1.0.0
type Subscription = event.Subscription
Subscription is a subscription to events. Consumer must be aware that publish will block if subsription is not read fast enough.
func SubscribeAccount ¶ added in v1.0.0
func SubscribeAccount() Subscription
SubscribeAccount subscribes to account data updates.
func SubscribeActivations ¶ added in v1.0.0
func SubscribeActivations() Subscription
SubscribeActivations subscribes to activations.
func SubscribeErrors ¶ added in v1.0.0
func SubscribeErrors() Subscription
SubscribeErrors subscribes to node errors.
func SubscribeLayers ¶ added in v1.0.0
func SubscribeLayers() Subscription
SubscribeLayers subscribes to all layer data.
func SubscribeMalfeasance ¶ added in v1.1.0
func SubscribeMalfeasance() Subscription
SubscribeMalfeasance subscribes malfeasance events.
func SubscribeProposals ¶ added in v1.6.0
func SubscribeProposals() Subscription
SubscribeProposals subscribes to the proposals.
func SubscribeRewards ¶ added in v1.0.0
func SubscribeRewards() Subscription
SubscribeRewards subscribes to rewards.
func SubscribeStatus ¶ added in v1.0.0
func SubscribeStatus() Subscription
SubscribeStatus subscribes to node status messages.
func SubscribeTxs ¶ added in v1.0.0
func SubscribeTxs() Subscription
SubscribeTxs subscribes to new transactions.
type Transaction ¶ added in v1.0.0
type Transaction struct { Transaction *types.Transaction LayerID types.LayerID Valid bool }
Transaction wraps a tx with its layer ID and validity info.