topicsTypes

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MWC is the multi-level wildcard
	MWC = "#"

	// SWC is the single level wildcard
	SWC = "+"
)

Variables

View Source
var (
	// TopicSubscribeRegexp regular expression that all subcriptions must be validated
	TopicSubscribeRegexp = regexp.MustCompile(`^(([^+#]*|\+)(/([^+#]*|\+))*(/#)?|#)$`)

	// TopicPublishRegexp regular expression that all publish to topic must be validated
	TopicPublishRegexp = regexp.MustCompile(`^[^#+]*$`)
)
View Source
var (

	// ErrInvalidArgs invalid arguments provided
	ErrInvalidArgs = errors.New("topics: invalid arguments")

	// ErrUnexpectedObjectType invalid arguments provided
	ErrUnexpectedObjectType = errors.New("topics: unexpected object type")

	// ErrUnknownProvider if provider is unknown
	ErrUnknownProvider = errors.New("topics: unknown provider")

	// ErrAlreadyExists object already exists
	ErrAlreadyExists = errors.New("topics: already exists")

	// ErrNotFound object not found
	ErrNotFound = errors.New("topics: not found")
)
View Source
var (
	// ErrMultiLevel multi-level wildcard
	ErrMultiLevel = errors.New("multi-level wildcard found in topic and it's not at the last level")
	// ErrInvalidSubscriber invalid subscriber object
	ErrInvalidSubscriber = errors.New("subscriber cannot be nil")
	// ErrInvalidWildcardPlus Wildcard character '+' must occupy entire topic level
	ErrInvalidWildcardPlus = errors.New("wildcard character '+' must occupy entire topic level")
	// ErrInvalidWildcardSharp Wildcard character '#' must occupy entire topic level
	ErrInvalidWildcardSharp = errors.New("wildcard character '#' must occupy entire topic level")
	// ErrInvalidWildcard Wildcard characters '#' and '+' must occupy entire topic level
	ErrInvalidWildcard = errors.New("wildcard characters '#' and '+' must occupy entire topic level")
)

Functions

This section is empty.

Types

type MemConfig

type MemConfig struct {
	Stat                     systree.TopicsStat
	Persist                  persistence.Retained
	OnCleanUnsubscribe       func([]string)
	Name                     string
	MaxQos                   mqttp.QosType
	OverlappingSubscriptions bool
}

MemConfig of topics manager

func NewMemConfig

func NewMemConfig() *MemConfig

NewMemConfig generate default config for memory

type Provider

type Provider interface {
	Subscribe(string, Subscriber, *vlsubscriber.SubscriptionParams) (mqttp.QosType, []*mqttp.Publish, error)
	UnSubscribe(string, Subscriber) error
	Publish(interface{}) error
	Retain(types.RetainObject) error
	Retained(string) ([]*mqttp.Publish, error)
	Stop() error
	Shutdown() error
}

Provider interface

type ProviderConfig

type ProviderConfig interface{}

ProviderConfig interface implemented by every backend

type Subscriber

type Subscriber interface {
	Acquire()
	Release()
	Publish(*mqttp.Publish, mqttp.QosType, mqttp.SubscriptionOptions, []uint32) error
	Hash() uintptr
}

Subscriber used inside each session as an object to provide to topic manager upon subscribe

type SubscriberInterface

type SubscriberInterface interface {
	Publish(interface{}) error
	Subscribe(string, Subscriber, *vlsubscriber.SubscriptionParams) (mqttp.QosType, []*mqttp.Publish, error)
	UnSubscribe(string, Subscriber) error
	Retain(types.RetainObject) error
	Retained(string) ([]*mqttp.Publish, error)
}

SubscriberInterface used by subscriber to handle messages

type Subscribers

type Subscribers []Subscriber

Subscribers used by topic manager to return list of subscribers matching topic

Jump to

Keyboard shortcuts

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