topicsTypes

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2018 License: Apache-2.0 Imports: 6 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 {
	TopicsStat                    systree.TopicsStat
	SubscriptionsStat             systree.SubscriptionsStat
	Persist                       persistence.Retained
	OnCleanUnsubscribe            func([]string)
	Name                          string
	MaxQosAllowed                 packet.QosType
	AllowOverlappingSubscriptions bool
}

MemConfig of topics manager

func NewMemConfig

func NewMemConfig() *MemConfig

NewMemConfig generate default config for memory

type Provider

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

Provider interface

type ProviderConfig

type ProviderConfig interface{}

ProviderConfig interface implemented by every backend

type Subscriber

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

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, *SubscriptionParams) (packet.QosType, []*packet.Publish, error)
	UnSubscribe(string, Subscriber) error
	Retain(types.RetainObject) error
	Retained(string) ([]*packet.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 SubscriptionParams

type SubscriptionParams struct {
	// Subscription id
	// V5.0 ONLY
	ID uint32

	// Ops requested subscription options
	Ops packet.SubscriptionOptions

	// Granted QoS granted by topics manager
	Granted packet.QosType

	Group string
}

SubscriptionParams parameters of the subscription

Jump to

Keyboard shortcuts

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