Documentation ¶
Index ¶
- Constants
- func GenerateSubscriptionID() (string, error)
- func PublishAll(ctx context.Context, subscribable Subscribable, subscriber string, ...) error
- func PublishWithEventID(publisher Publisher, eventID string, eventData interface{}, ...) error
- func SubscribeCallback(ctx context.Context, subscribable Subscribable, subscriber string, ...) error
- type Cache
- type Emitter
- type Publisher
- type Query
- type QueryBuilder
- func (qb *QueryBuilder) And(queryBuilders ...*QueryBuilder) *QueryBuilder
- func (qb *QueryBuilder) AndContains(tag string, operand interface{}) *QueryBuilder
- func (qb *QueryBuilder) AndEquals(tag string, operand interface{}) *QueryBuilder
- func (qb *QueryBuilder) AndGreaterThanOrEqual(tag string, operand interface{}) *QueryBuilder
- func (qb *QueryBuilder) AndLessThanOrEqual(tag string, operand interface{}) *QueryBuilder
- func (qb *QueryBuilder) AndStrictlyGreaterThan(tag string, operand interface{}) *QueryBuilder
- func (qb *QueryBuilder) AndStrictlyLessThan(tag string, operand interface{}) *QueryBuilder
- func (qb *QueryBuilder) Query() (pubsub.Query, error)
- func (qb *QueryBuilder) String() string
- type QueryString
- type Queryable
- type Subscribable
Constants ¶
View Source
const ( EventIDKey = "EventID" MessageTypeKey = "MessageType" TxTypeKey = "TxType" TxHashKey = "TxHash" StackDepthKey = "StackDepth" )
View Source
const DefaultEventBufferCapacity = 2 << 10
Variables ¶
This section is empty.
Functions ¶
func GenerateSubscriptionID ¶ added in v0.18.0
func PublishAll ¶ added in v0.18.0
func PublishWithEventID ¶ added in v0.18.0
func SubscribeCallback ¶ added in v0.18.0
func SubscribeCallback(ctx context.Context, subscribable Subscribable, subscriber string, query Queryable, callback func(message interface{}) bool) error
Subscribe to messages matching query and launch a goroutine to run a callback for each one. The goroutine will exit when the context is done or the subscription is removed.
Types ¶
type Cache ¶ added in v0.18.0
type Cache struct {
// contains filtered or unexported fields
}
A Cache buffers events for a Publisher.
func NewEventCache ¶ added in v0.18.0
Create a new Cache with an EventSwitch as backend
type Emitter ¶ added in v0.18.0
type Emitter interface { Subscribable Publisher process.Process }
func NewEmitter ¶ added in v0.18.0
type Publisher ¶ added in v0.18.0
type Query ¶ added in v0.18.0
type Query struct {
// contains filtered or unexported fields
}
A pre-parsed query
type QueryBuilder ¶ added in v0.18.0
type QueryBuilder struct { // reusable buffer for building queryString bytes.Buffer // contains filtered or unexported fields }
A fluent query builder
func NewQueryBuilder ¶ added in v0.18.0
func NewQueryBuilder(queries ...string) *QueryBuilder
Creates a new query builder with a base query that is the conjunction of all queries passed
func QueryForEventID ¶ added in v0.18.0
func QueryForEventID(eventID string) *QueryBuilder
Get a query that matches events with a specific eventID
func (*QueryBuilder) And ¶ added in v0.18.0
func (qb *QueryBuilder) And(queryBuilders ...*QueryBuilder) *QueryBuilder
Creates the conjunction of QueryBuilder and rightQuery
func (*QueryBuilder) AndContains ¶ added in v0.18.0
func (qb *QueryBuilder) AndContains(tag string, operand interface{}) *QueryBuilder
func (*QueryBuilder) AndEquals ¶ added in v0.18.0
func (qb *QueryBuilder) AndEquals(tag string, operand interface{}) *QueryBuilder
Creates the conjunction of QueryBuilder and tag = operand
func (*QueryBuilder) AndGreaterThanOrEqual ¶ added in v0.18.0
func (qb *QueryBuilder) AndGreaterThanOrEqual(tag string, operand interface{}) *QueryBuilder
func (*QueryBuilder) AndLessThanOrEqual ¶ added in v0.18.0
func (qb *QueryBuilder) AndLessThanOrEqual(tag string, operand interface{}) *QueryBuilder
func (*QueryBuilder) AndStrictlyGreaterThan ¶ added in v0.18.0
func (qb *QueryBuilder) AndStrictlyGreaterThan(tag string, operand interface{}) *QueryBuilder
func (*QueryBuilder) AndStrictlyLessThan ¶ added in v0.18.0
func (qb *QueryBuilder) AndStrictlyLessThan(tag string, operand interface{}) *QueryBuilder
func (*QueryBuilder) String ¶ added in v0.18.0
func (qb *QueryBuilder) String() string
type Queryable ¶ added in v0.18.0
func MatchAllQueryable ¶ added in v0.18.0
func MatchAllQueryable() Queryable
type Subscribable ¶ added in v0.18.0
type Subscribable interface { // Subscribe to all events matching query, which is a valid tmlibs Query Subscribe(ctx context.Context, subscriber string, query Queryable, out chan<- interface{}) error // Unsubscribe subscriber from a specific query string Unsubscribe(ctx context.Context, subscriber string, query Queryable) error UnsubscribeAll(ctx context.Context, subscriber string) error }
Click to show internal directories.
Click to hide internal directories.