event

package
v0.0.0-...-5e88e9b Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FireEvent

func FireEvent(event *Event)

func GracefulStop

func GracefulStop()

close receivers on system stop.

func Subscribe

func Subscribe(subscriber *Receiver, topic Topic)

func Unsubscribe

func Unsubscribe(suber *actor.PID, topic Topic)

Types

type ChainEvent

type ChainEvent struct {
	Block *types.Block
	Hash  common.Hash
	Logs  []*types.Log
}

type ChainHeadEvent

type ChainHeadEvent struct {
	Message *types.Block
}

type ChainSideEvent

type ChainSideEvent struct {
	Block *types.Block
}

type EleType

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

type Event

type Event struct {
	Topic   Topic
	Payload interface{}
	Trigger *Trigger
}

type EventType

type EventType int16

type LogsEvent

type LogsEvent struct {
	Logs []*types.Log
}

type Receiver

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

func RegisterReceiver

func RegisterReceiver(name string, fn func(payload interface{})) *Receiver

type RemovedLogsEvent

type RemovedLogsEvent struct {
	Logs []*types.Log
}

type Subscriber

type Subscriber chan interface{}

type Subscribers

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

type SyncEvent

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

func NewEvent

func NewEvent() *SyncEvent

func (*SyncEvent) Notify

func (e *SyncEvent) Notify(eventtype EventType, value interface{}) (err error)

Notify subscribers that Subscribe specified event

func (*SyncEvent) NotifyAll

func (e *SyncEvent) NotifyAll(v interface{}) (errs []error)

Notify all event subscribers

func (*SyncEvent) NotifyChannel

func (e *SyncEvent) NotifyChannel(subscriber Subscriber, value interface{}) (err error)

Notify with subscriber channel.

func (*SyncEvent) Subscribe

func (e *SyncEvent) Subscribe(eventtype EventType) Subscriber

Subscribe specified event.

func (*SyncEvent) UnSubscribe

func (e *SyncEvent) UnSubscribe(eventtype EventType, subscriber Subscriber) (err error)

UnSubscribe the event and remove the specified subscriber

type Topic

type Topic string
const (
	RemovedLogsTopic Topic = "removed_logs_topic"
	ChainEventTopic  Topic = "chain_event_topic"
	ChainHeadTopic   Topic = "chain_head_topic"
	ChainSideTopic   Topic = "chain_side_topic"
	LogTopic         Topic = "log_topic"

	TxPreTopic Topic = "tx_pre_topic"
)

type Trigger

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

func RegisterTrigger

func RegisterTrigger(name string) *Trigger

type TxPreEvent

type TxPreEvent struct {
	Message *types.Transaction
}

Directories

Path Synopsis
sub
filter
Package filter implements event filters.
Package filter implements event filters.

Jump to

Keyboard shortcuts

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