event

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSubId

func GenerateSubId() (string, error)

func GetRangeFilter

func GetRangeFilter(op, fName string) (func(a, b int64) bool, error)

func GetStringFilter

func GetStringFilter(op, fName string) (func(s0, s1 string) bool, error)

func Multiplex

func Multiplex(events ...EventEmitter) *multiplexedEvents

Provides an EventEmitter that wraps many underlying EventEmitters as a convenience for Subscribing and Unsubscribing on multiple EventEmitters at once

func NewEvents

func NewEvents(eventSwitch go_events.EventSwitch, logger loggers.InfoTraceLogger) *events

func ParseNumberValue

func ParseNumberValue(value string) (int64, error)

Types

type CompositeFilter

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

Filter made up of many filters.

func (*CompositeFilter) Match

func (this *CompositeFilter) Match(v interface{}) bool

func (*CompositeFilter) SetData

func (this *CompositeFilter) SetData(filters []Filter)

type ConfigurableFilter

type ConfigurableFilter interface {
	Filter
	Configure(*FilterData) error
}

A filter that can be configured with in-data.

type EventCache

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

type EventEmitter

type EventEmitter interface {
	Subscribe(subId, event string, callback func(txs.EventData)) error
	Unsubscribe(subId string) error
}

type EventSub

type EventSub struct {
	SubId string `json:"sub_id"`
}

EventSubscribe

type EventSubscriptions

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

Catches events that callers subscribe to and adds them to an array ready to be polled.

func NewEventSubscriptions

func NewEventSubscriptions(eventEmitter EventEmitter) *EventSubscriptions

func (*EventSubscriptions) Add

func (this *EventSubscriptions) Add(eventId string) (string, error)

Add a subscription and return the generated id. Note event dispatcher has to call func which involves acquiring a mutex lock, so might be a delay - though a conflict is practically impossible, and if it does happen it's for an insignificant amount of time (the time it takes to carry out EventCache.poll() ).

func (*EventSubscriptions) Poll

func (this *EventSubscriptions) Poll(subId string) ([]interface{}, error)

func (*EventSubscriptions) Remove

func (this *EventSubscriptions) Remove(subId string) error

type EventUnsub

type EventUnsub struct {
	Result bool `json:"result"`
}

EventUnsubscribe

type Filter

type Filter interface {
	Match(v interface{}) bool
}

Filters based on fields.

type FilterData

type FilterData struct {
	Field string `json:"field"`
	Op    string `json:"op"`
	Value string `json:"value"`
}

Used to filter. Op can be any of the following: The usual relative operators: <, >, <=, >=, ==, != (where applicable) A range parameter (see: https://help.github.com/articles/search-syntax/)

type FilterFactory

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

Used to generate filters based on filter data. Keeping separate pools for "edge cases" (Composite and MatchAll)

func NewFilterFactory

func NewFilterFactory() *FilterFactory

func (*FilterFactory) NewFilter

func (this *FilterFactory) NewFilter(fdArr []*FilterData) (Filter, error)

Creates a new filter given the input data array. If the array is zero length or nil, an empty filter will be returned that returns true on all matches. If the array is of size 1, a regular filter is returned, otherwise a CompositeFieldFilter is returned, which is a special filter that contains a number of other filters. It implements AccountFieldFilter, and will match an account only if all the sub-filters matches.

func (*FilterFactory) RegisterFilterPool

func (this *FilterFactory) RegisterFilterPool(fieldName string, pool *sync.Pool)

type MatchAllFilter

type MatchAllFilter struct{}

Rubberstamps everything.

func (*MatchAllFilter) Match

func (this *MatchAllFilter) Match(v interface{}) bool

type PollResponse

type PollResponse struct {
	Events []interface{} `json:"events"`
}

EventPoll

Jump to

Keyboard shortcuts

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