internal

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the MIT License.

Copyright (c) Microsoft Corporation. Licensed under the MIT License.

Copyright (c) Microsoft Corporation. Licensed under the MIT License.

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 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.

func ValidateTopicPatternComponent added in v0.3.0

func ValidateTopicPatternComponent(
	name, msgOnErr, pattern string,
) error

Perform initial validation of a topic pattern component.

Types

type Timeout

type Timeout struct {
	time.Duration
	Name string
	Text string
}

Struct to apply an optional timeout.

func (*Timeout) Context added in v0.2.0

func (to *Timeout) Context(
	ctx context.Context,
) (context.Context, context.CancelFunc)

func (*Timeout) MessageExpiry added in v0.2.0

func (to *Timeout) MessageExpiry() uint32

func (*Timeout) Validate added in v0.2.0

func (to *Timeout) Validate() error

type TopicFilter added in v0.2.0

type TopicFilter struct {
	// contains filtered or unexported fields
}

Structure to provide a topic filter that can parse out its named tokens.

func (*TopicFilter) Filter added in v0.2.0

func (tf *TopicFilter) Filter() string

Filter provides the MQTT topic filter string.

func (*TopicFilter) Tokens added in v0.2.0

func (tf *TopicFilter) Tokens(topic string) (map[string]string, bool)

Tokens indicates whether the topic matched and resolves its topic tokens.

type TopicPattern

type TopicPattern struct {
	// contains filtered or unexported fields
}

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) Filter

func (tp *TopicPattern) Filter() (*TopicFilter, error)

Generate a filter 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