event

package
v0.0.0-...-25a45d7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2019 License: Apache-2.0 Imports: 10 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 interface {
	Subscribable
	Publisher
	process.Process
}

func NewEmitter

func NewEmitter(logger *logging.Logger) Emitter

type EventID

type EventID string

func (EventID) Matches

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

func (EventID) String

func (eid EventID) String() string

type Publisher

type Publisher interface {
	Publish(ctx context.Context, message interface{}, tag query.Tagged) error
}

func NewNoOpPublisher

func NewNoOpPublisher() Publisher

NoOpPublisher

type PublisherFunc

type PublisherFunc func(ctx context.Context, message interface{}, tags query.Tagged) error

func (PublisherFunc) Publish

func (pf PublisherFunc) Publish(ctx context.Context, message interface{}, tags query.Tagged) error

type Subscribable

type Subscribable interface {
	// Subscribe to all events matching query, which is a valid tmlibs Query. Blocking the out channel blocks the entire
	// pubsub.
	Subscribe(ctx context.Context, subscriber string, queryable query.Queryable, bufferSize int) (out <-chan interface{}, err error)
	// Unsubscribe subscriber from a specific query string. Note the subscribe channel must be drained.
	Unsubscribe(ctx context.Context, subscriber string, queryable query.Queryable) error
	UnsubscribeAll(ctx context.Context, subscriber string) error
}

TODO: manage the creation, closing, and draining of channels behind the interface rather than only closing. stop one subscriber from blocking everything!

Directories

Path Synopsis
This package was extracted from Tendermint
This package was extracted from Tendermint
Package query provides a parser for a custom query format:
Package query provides a parser for a custom query format:

Jump to

Keyboard shortcuts

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