event

package
v0.0.0-...-2935fa7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeKey   = "EventType"
	EventIDKey     = "EventID"
	MessageTypeKey = "MessageType"
	TxHashKey      = "TxHash"
	HeightKey      = "Height"
	IndexKey       = "Index"
	StackDepthKey  = "StackDepth"
	AddressKey     = "Address"
)
View Source
const DefaultEventBufferCapacity = 2 << 10

Variables

This section is empty.

Functions

func GenSubID

func GenSubID() string

func QueryForEventID

func QueryForEventID(eventID string) query.Queryable

Get a query that matches events with a specific eventID

Types

type Emitter

type Emitter struct {
	service.BaseService
	// contains filtered or unexported fields
}

Emitter has methods for working with events

func NewEmitter

func NewEmitter() *Emitter

NewEmitter initializes an emitter struct with a pubsubServer

func (*Emitter) Publish

func (em *Emitter) Publish(ctx context.Context, message interface{}, tags query.Tagged) error

Publish tells the emitter to publish with the given message and tags

func (*Emitter) SetLogger

func (em *Emitter) SetLogger(logger *logging.Logger)

SetLogger attaches a log handler to this emitter

func (*Emitter) Shutdown

func (em *Emitter) Shutdown(ctx context.Context) error

Shutdown stops the pubsubServer

func (*Emitter) Subscribe

func (em *Emitter) Subscribe(ctx context.Context, subscriber string, queryable query.Queryable, bufferSize int) (<-chan interface{}, error)

Subscribe tells the emitter to listen for messages on the given query

func (*Emitter) Unsubscribe

func (em *Emitter) Unsubscribe(ctx context.Context, subscriber string, queryable query.Queryable) error

Unsubscribe tells the emitter to stop listening for said messages

func (*Emitter) UnsubscribeAll

func (em *Emitter) UnsubscribeAll(ctx context.Context, subscriber string) error

UnsubscribeAll just stop listening for all messages

type EventID

type EventID string

func (EventID) MatchError

func (eid EventID) MatchError() error

func (EventID) Matches

func (eid EventID) Matches(tags query.Tagged) bool

func (EventID) String

func (eid EventID) String() string

Directories

Path Synopsis
This package was extracted from Tendermint Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
This package was extracted from Tendermint Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.

Jump to

Keyboard shortcuts

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