Documentation ¶
Index ¶
- type EventDispatcher
- func (ed *EventDispatcher) Accept(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
- func (ed *EventDispatcher) DeregisterChain(chainID ids.ID, identifier string) error
- func (ed *EventDispatcher) Issue(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
- func (ed *EventDispatcher) RegisterChain(chainID ids.ID, identifier string, handlerFunc interface{}, dieOnError bool) error
- func (ed *EventDispatcher) Reject(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventDispatcher ¶
type EventDispatcher struct {
// contains filtered or unexported fields
}
EventDispatcher receives events from consensus and dispatches the events to triggers
func New ¶
func New(log logging.Logger) *EventDispatcher
func (*EventDispatcher) Accept ¶
func (ed *EventDispatcher) Accept(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
Accept is called when a transaction or block is accepted. If the returned error is non-nil, the chain associated with [ctx] should shut down and not commit [container] or any other container to its database as accepted.
func (*EventDispatcher) DeregisterChain ¶
func (ed *EventDispatcher) DeregisterChain(chainID ids.ID, identifier string) error
DeregisterChain removes a chain handler from the system
func (*EventDispatcher) Issue ¶
func (ed *EventDispatcher) Issue(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
Issue is called when a transaction or block is issued
func (*EventDispatcher) RegisterChain ¶
func (ed *EventDispatcher) RegisterChain(chainID ids.ID, identifier string, handlerFunc interface{}, dieOnError bool) error
RegisterChain causes [handlerFunc] to be invoked every time a container is issued, accepted or rejected on chain [chainID]. [handlerFunc] should implement at least one of Acceptor, Rejector, Issuer. If [dieOnError], chain [chainID] stops if [handler].Accept is invoked and returns a non-nil error.
func (*EventDispatcher) Reject ¶
func (ed *EventDispatcher) Reject(ctx *snow.ConsensusContext, containerID ids.ID, container []byte) error
Reject is called when a transaction or block is rejected