event

package
v1.3.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match(pattern, name string) (matched bool)

Match - finds whether the text matches/satisfies the pattern string. supports '*' and '?' wildcards in the pattern string. unlike path.Match(), considers a path as a flat name space while matching the pattern. The difference is illustrated in the example here https://play.golang.org/p/Ega9qgD4Qz .

func MatchSimple

func MatchSimple(pattern, name string) bool

MatchSimple - finds whether the text matches/satisfies the pattern string. supports only '*' wildcard in the pattern. considers a file system path as a flat name space.

Types

type DefaultEventBus

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

DefaultEventBus

func (*DefaultEventBus) Close added in v1.2.0

func (eb *DefaultEventBus) Close() error

func (*DefaultEventBus) CloseTopic added in v1.2.0

func (eb *DefaultEventBus) CloseTopic(topic common.TopicType)

Close unsubscribe all handlers from given topic

func (*DefaultEventBus) HasCallback

func (eb *DefaultEventBus) HasCallback(topic common.TopicType) bool

HasCallback returns true if exists any callback subscribed to the topic.

func (*DefaultEventBus) Publish

func (eb *DefaultEventBus) Publish(topic common.TopicType, args ...interface{})

Publish executes callback defined for a topic. Any additional argument will be transferred to the callback.

func (*DefaultEventBus) Subscribe

func (eb *DefaultEventBus) Subscribe(topic common.TopicType, fn interface{}) (string, error)

Subscribe subscribes to a topic. Returns error if `fn` is not a function.

func (*DefaultEventBus) SubscribeSync added in v1.2.0

func (eb *DefaultEventBus) SubscribeSync(topic common.TopicType, fn interface{}) (string, error)

func (*DefaultEventBus) Unsubscribe

func (eb *DefaultEventBus) Unsubscribe(topic common.TopicType, handler string) error

Unsubscribe removes callback defined for a topic. Returns error if there are no callbacks subscribed to the topic.

type EventBus

type EventBus interface {
	io.Closer
	// contains filtered or unexported methods
}

func GetEventBus

func GetEventBus(id string) EventBus

func New

func New() EventBus

New returns new DefaultEventBus with empty handlers.

func NewEventBus added in v1.2.0

func NewEventBus(queueSize int) EventBus

func SimpleEventBus

func SimpleEventBus() EventBus

Jump to

Keyboard shortcuts

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