event

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Queue = NewEventQueue()

Functions

This section is empty.

Types

type EventFunc

type EventFunc func(v interface{})

type EventQueue

type EventQueue struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewEventQueue

func NewEventQueue() *EventQueue

func (*EventQueue) Notify

func (eq *EventQueue) Notify(eventType EventType, value interface{})

Notify subscribers that Subscribe specified event

func (*EventQueue) Subscribe

func (eq *EventQueue) Subscribe(eventType EventType, eventFunc EventFunc) int

Subscribe adds a new subscriber to Event.

func (*EventQueue) Unsubscribe

func (eq *EventQueue) Unsubscribe(eventType EventType, subscriberIdx int) error

Unsubscribe removes the specified subscriber

type EventType

type EventType uint8
const (
	// BlockPersistCompleted is called for both consensus and block syncing
	BlockPersistCompleted EventType = iota
	// NewBlockProduced is called only for consensus, but NOT block syncing
	NewBlockProduced
	SendInboundMessageToClient
	BacktrackSigChain
	PinSigChain
)

Jump to

Keyboard shortcuts

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