topicsTypes

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 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 = "+"

	// SEP is the topic level separator
	SEP = "/"
)

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 {
	SubscriberInterface
	Shutdown() error
}

Provider interface

type ProviderConfig

type ProviderConfig interface{}

ProviderConfig interface implemented by every backend

type SubscribeReq added in v0.2.4

type SubscribeReq struct {
	Filter string
	S      Subscriber
	Params *vlsubscriber.SubscriptionParams
	Chan   chan<- SubscribeResp
}

type SubscribeResp added in v0.2.4

type SubscribeResp struct {
	Granted  mqttp.QosType
	Retained []*mqttp.Publish
	Err      error
}

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(SubscribeReq) error
	UnSubscribe(UnSubscribeReq) 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

type UnSubscribeReq added in v0.2.4

type UnSubscribeReq struct {
	Filter string
	S      Subscriber
	Chan   chan<- UnSubscribeResp
}

type UnSubscribeResp added in v0.2.4

type UnSubscribeResp struct {
	Err error
}

Jump to

Keyboard shortcuts

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