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.
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 ¶
- func MapToUserProperties(m map[string]string) paho.UserProperties
- func SanitizeString(input string) string
- func UserPropertiesToMap(ups paho.UserProperties) map[string]string
- type AppendableListWithRemoval
- type Background
- type ConnectionTracker
- func (c *ConnectionTracker[Client]) Attempt() uint64
- func (c *ConnectionTracker[Client]) Client(ctx context.Context) iter.Seq2[context.Context, Client]
- func (c *ConnectionTracker[Client]) Connect(client Client) error
- func (c *ConnectionTracker[Client]) Current() CurrentConnection[Client]
- func (c *ConnectionTracker[Client]) Disconnect(attempt uint64, err error)
- type CurrentConnection
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapToUserProperties ¶ added in v0.3.0
func MapToUserProperties(m map[string]string) paho.UserProperties
MapToUserProperties converts a map[string]string to userProperties.
func SanitizeString ¶ added in v0.3.0
SanitizeString removes all characters that are not valid in MQTT strings. Since they are otherwise non-printable characters, they are not replaced with any placeholder.
func UserPropertiesToMap ¶ added in v0.3.0
func UserPropertiesToMap(ups paho.UserProperties) map[string]string
UserPropertiesToMap converts userProperties to a map[string]string.
Types ¶
type AppendableListWithRemoval ¶ added in v0.2.0
type AppendableListWithRemoval[T any] struct { // contains filtered or unexported fields }
func NewAppendableListWithRemoval ¶ added in v0.2.0
func NewAppendableListWithRemoval[T any]() *AppendableListWithRemoval[T]
func (*AppendableListWithRemoval[T]) All ¶ added in v0.2.0
func (l *AppendableListWithRemoval[T]) All() iter.Seq[T]
func (*AppendableListWithRemoval[T]) AppendEntry ¶ added in v0.2.0
func (l *AppendableListWithRemoval[T]) AppendEntry( value T, ) (removeEntry func())
type Background ¶ added in v0.3.0
type Background struct {
// contains filtered or unexported fields
}
Background is an abstraction the concept of a long-running backround process, which contexts may need to tie to.
func NewBackground ¶ added in v0.3.0
func NewBackground(err error) *Background
func (*Background) Close ¶ added in v0.3.0
func (b *Background) Close()
func (*Background) Done ¶ added in v0.3.0
func (b *Background) Done() <-chan struct{}
func (*Background) With ¶ added in v0.3.0
func (b *Background) With( ctx context.Context, ) (context.Context, context.CancelFunc)
type ConnectionTracker ¶ added in v0.3.0
type ConnectionTracker[Client comparable] struct { // contains filtered or unexported fields }
Struct to track the connection state of the client, and retreive the currently connected client.
func NewConnectionTracker ¶ added in v0.3.0
func NewConnectionTracker[Client comparable]() *ConnectionTracker[Client]
func (*ConnectionTracker[Client]) Attempt ¶ added in v0.3.0
func (c *ConnectionTracker[Client]) Attempt() uint64
func (*ConnectionTracker[Client]) Client ¶ added in v0.3.0
func (c *ConnectionTracker[Client]) Client( ctx context.Context, ) iter.Seq2[context.Context, Client]
Return the client for the current connection. Since the client gets replaced when the we reconnect, this is represented as an iterator. The caller should return from the loop once the call they're trying to make is complete, or continue the loop if we need to reconnect and try again. The loop will only terminate on its own via the context. It also provides a context which will be closed if the client disconnects, in order to terminate any requests.
func (*ConnectionTracker[Client]) Connect ¶ added in v0.3.0
func (c *ConnectionTracker[Client]) Connect(client Client) error
func (*ConnectionTracker[Client]) Current ¶ added in v0.3.0
func (c *ConnectionTracker[Client]) Current() CurrentConnection[Client]
func (*ConnectionTracker[Client]) Disconnect ¶ added in v0.3.0
func (c *ConnectionTracker[Client]) Disconnect(attempt uint64, err error)
type CurrentConnection ¶ added in v0.3.0
type CurrentConnection[Client comparable] struct { // Current instance of the client. Client Client // Error that caused the last disconnection. Error error // Background state that is stopped when the the connection is down. // Used to notify goroutines that expect the connection to go down that // the manageConnection() goroutine has detected the disconnection and // is attempting to start a new connection. Down *Background // Counter for the current connection attempt. This is independent from // the client, since it also records unsuccessful connect attempts. Attempt uint64 // contains filtered or unexported fields }
Mutex-protected connection data.