event

package
v0.0.0-...-84d53aa Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: GPL-3.0 Imports: 4 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// TopicLibBlock latest irreversible block.
	TopicLibBlock = "chain.latestIrreversibleBlock"
	// TopicNewTailBlock new tail block set
	TopicNewTailBlock = "chain.newTailBlock"
	// TopicPendingTransaction Pending transactions in a pending pool.
	TopicPendingTransaction = "chain.pendingTransaction"
	// TopicFutureTransaction future transactions in a future pool
	TopicFutureTransaction = "chain.futureTransaction"
	// TopicRevertBlock revert block
	TopicRevertBlock = "chain.revertBlock"
	// TopicTransactionExecutionResult transaction execution result
	TopicTransactionExecutionResult = "chain.transactionResult"
	// TopicBlockAccepted new block accepted on the chain
	TopicAcceptedBlock = "chain.acceptedBlock"
	// TopicInvalidBLock block is invalid
	TopicInvalidBlock = "chain.invalidBlock"
)

TODO @ggomma check whether event emitter exists

View Source
const (
	TypeAccountTransactionExecution = "executedTransaction"
	TypeAccountTransactionPending   = "pendingTransaction"
	TypeAccountTransactionFuture    = "futureTransaction"
	TypeAccountTransactionDeleted   = "deletedTransaction"
)

Type for account transaction result

Variables

View Source
var (
	ErrWrongEventTopic = errors.New("required event topic doesn't exist in topic list")
)

errors

Functions

This section is empty.

Types

type Emitter

type Emitter struct {
	// contains filtered or unexported fields
}

Emitter structure

func NewEventEmitter

func NewEventEmitter(size int) *Emitter

NewEventEmitter creates new event emitter

func (*Emitter) Deregister

func (e *Emitter) Deregister(subscribers ...*Subscriber)

Deregister event channel

func (*Emitter) Register

func (e *Emitter) Register(subscribers ...*Subscriber)

Register event channel

func (*Emitter) Start

func (e *Emitter) Start()

Start event loop

func (*Emitter) Stop

func (e *Emitter) Stop()

Stop event loop

func (*Emitter) Trigger

func (e *Emitter) Trigger(event *Event)

Trigger event

type Event

type Event struct {
	Topic string
	Data  string
	Type  string
}

Event structure

type Subscriber

type Subscriber struct {
	// contains filtered or unexported fields
}

Subscriber structure

func NewSubscriber

func NewSubscriber(size int, topics []string) (*Subscriber, error)

NewSubscriber creates new event subscriber

func (*Subscriber) EventChan

func (s *Subscriber) EventChan() chan *Event

EventChan returns event channel

Jump to

Keyboard shortcuts

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