subscriber

package
v0.1.1-0...-84673a0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(string, *events_pb2.Event) bool

Handler is a sawtooth subscriber handler. Return true if need to pass next handler, or return false.

type Subscriber

type Subscriber struct {
	RecordBlockID bool // flag to record last block id into file.

	OnClose        func()
	OnSubcribed    func(string, *client_event_pb2.ClientEventsSubscribeResponse)
	OnUnsubscribed func(string, *client_event_pb2.ClientEventsUnsubscribeResponse)
	// contains filtered or unexported fields
}

Subscriber is a sawtooth event subscriber.

func New

func New(endpoint string, wait time.Duration) (*Subscriber, error)

New returns a subcriber for some sawtooth events.

func (*Subscriber) HandleFunc

func (s *Subscriber) HandleFunc(eventType string, h Handler)

HandleFunc appends an handler for some event.

func (*Subscriber) Subscribe

func (s *Subscriber) Subscribe(eventType string, h Handler, filters ...*events_pb2.EventFilter)

Subscribe records an event subscription with filters and handler for it.

func (*Subscriber) WaitForShutdown

func (s *Subscriber) WaitForShutdown(lastBlockIDs ...string)

WaitForShutdown is to start a subscriber and wait for shutdown.

Jump to

Keyboard shortcuts

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