eventsdk

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

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

Event exposes event APIs of MESG.

func New

func New(ps *pubsub.PubSub, service *servicesdk.SDK, instance *instancesdk.SDK) *Event

New creates a new Event SDK with given options.

func (*Event) Create

func (e *Event) Create(instanceHash hash.Hash, eventKey string, eventData *types.Struct) (*event.Event, error)

Create a MESG event eventKey with eventData for service token.

func (*Event) GetStream

func (e *Event) GetStream(f *Filter) *Listener

GetStream broadcasts all events.

type Filter

type Filter struct {
	Hash         hash.Hash
	InstanceHash hash.Hash
	Key          string
}

Filter store fileds for matching events.

func (*Filter) HasKey

func (f *Filter) HasKey() bool

HasKey returns true if key is set to specified value.

func (*Filter) Match

func (f *Filter) Match(e *event.Event) bool

Match matches event.

type Listener

type Listener struct {
	C chan *event.Event
	// contains filtered or unexported fields
}

Listener provides functionalities to listen MESG events.

func NewListener

func NewListener(ps *pubsub.PubSub, topic string, f *Filter) *Listener

NewListener creates a new Listener with given sdk and filters.

func (*Listener) Close

func (l *Listener) Close()

Close stops listening for events.

func (*Listener) Listen

func (l *Listener) Listen()

Listen listens events that match filter.

Jump to

Keyboard shortcuts

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