internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Concurrent

func Concurrent[T any](
	concurrency uint,
	handler func(context.Context, T),
) (func(context.Context, T), func())

Manages sending values to handlers with a configured maximum currency (where 0 indicates unlimited concurrency). Returns a function to send a value to the handlers and a cleanup function.

func MessageExpiryTimeout

func MessageExpiryTimeout(
	ctx context.Context,
	expiry uint32,
	s string,
) (context.Context, context.CancelFunc)

Translate an MQTT message expiry into a timeout. Use for WithMessageExpiry.

func MetadataToProp

func MetadataToProp(data map[string]string) (map[string]string, error)

func PropToMetadata

func PropToMetadata(prop map[string]string) map[string]string

func ValidTopic

func ValidTopic(topic string) bool

Return whether the provided string is a fully-resolved topic.

func ValidateShareName

func ValidateShareName(shareName string) error

Return whether the provided string is a valid share name.

Types

type Timeout

Function to apply an optional timeout.

func NewExecutionTimeout

func NewExecutionTimeout(to time.Duration, s string) (Timeout, error)

Apply an optional context timeout. Use for WithExecutionTimeout.

type TopicPattern

type TopicPattern struct {
	Name    string
	Pattern string
}

Structure to apply tokens to a named topic pattern.

func NewTopicPattern

func NewTopicPattern(
	name, pattern string,
	tokens map[string]string,
	namespace string,
) (TopicPattern, error)

Create a new topic pattern and perform initial validations.

func (TopicPattern) Apply

func (tp TopicPattern) Apply(tokens map[string]string) TopicPattern

Apply the given token values to the MQTT topic and return the result (which may still have remaining unresolved tokens).

func (TopicPattern) Filter

func (tp TopicPattern) Filter() (string, error)

Generate a regexp for subscribing. Unresolved tokens are treated as "+" wildcards for this purpose.

func (TopicPattern) Topic

func (tp TopicPattern) Topic(tokens map[string]string) (string, error)

Fully resolve a topic pattern for publishing.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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