provider

package
v3.18.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterProvider

func RegisterProvider(p ttnpb.ApplicationPubSub_Provider, implementation Provider)

RegisterProvider registers an implementation for a given pub/sub provider.

Types

type Connection

type Connection struct {
	Topics             UplinkTopics
	Subscriptions      DownlinkSubscriptions
	ProviderConnection ProviderConnection
}

Connection is a wrapper that wraps the topics and subscriptions with a ProviderConnection.

func (*Connection) Shutdown

func (c *Connection) Shutdown(ctx context.Context) error

Shutdown shuts down the topics, subscriptions and the connections if required.

type DownlinkSubscriptions

type DownlinkSubscriptions struct {
	Push    *pubsub.Subscription
	Replace *pubsub.Subscription
}

DownlinkSubscriptions contains the subscriptions for the push and replace queue operations.

func (*DownlinkSubscriptions) Shutdown

func (ds *DownlinkSubscriptions) Shutdown(ctx context.Context) error

Shutdown shutdowns the active subscriptions.

type Enabler added in v3.11.0

type Enabler interface {
	Enabled(ctx context.Context, provider ttnpb.ApplicationPubSub_Provider) error
}

Enabler enables providers.

type Provider

type Provider interface {
	OpenConnection(ctx context.Context, target Target, enabler Enabler) (*Connection, error)
}

Provider represents a pub/sub service provider.

func GetProvider

func GetProvider(target Target) (Provider, error)

GetProvider returns an implementation for a given target.

type ProviderConnection

type ProviderConnection interface {
	Shutdowner
}

ProviderConnection is an interface that represents a provider specific connection.

type Shutdowner

type Shutdowner interface {
	Shutdown(ctx context.Context) error
}

Shutdowner is an interface that contains a contextual shutdown method.

type Target

type Target interface {
	Topics
	GetProvider() ttnpb.ApplicationPubSub_Provider
}

Target represents settings for a pub/sub provider to connect.

type Topics added in v3.9.0

type Topics interface {
	GetBaseTopic() string
	GetUplinkMessage() *ttnpb.ApplicationPubSub_Message
	GetJoinAccept() *ttnpb.ApplicationPubSub_Message
	GetDownlinkAck() *ttnpb.ApplicationPubSub_Message
	GetDownlinkNack() *ttnpb.ApplicationPubSub_Message
	GetDownlinkSent() *ttnpb.ApplicationPubSub_Message
	GetDownlinkFailed() *ttnpb.ApplicationPubSub_Message
	GetDownlinkQueued() *ttnpb.ApplicationPubSub_Message
	GetDownlinkQueueInvalidated() *ttnpb.ApplicationPubSub_Message
	GetLocationSolved() *ttnpb.ApplicationPubSub_Message
	GetServiceData() *ttnpb.ApplicationPubSub_Message
	GetDownlinkPush() *ttnpb.ApplicationPubSub_Message
	GetDownlinkReplace() *ttnpb.ApplicationPubSub_Message
}

Topics provide a pub/sub base topic and optional, per-message sub-topics.

type UplinkTopics

type UplinkTopics struct {
	UplinkMessage            *pubsub.Topic
	JoinAccept               *pubsub.Topic
	DownlinkAck              *pubsub.Topic
	DownlinkNack             *pubsub.Topic
	DownlinkSent             *pubsub.Topic
	DownlinkFailed           *pubsub.Topic
	DownlinkQueued           *pubsub.Topic
	DownlinkQueueInvalidated *pubsub.Topic
	LocationSolved           *pubsub.Topic
	ServiceData              *pubsub.Topic
}

UplinkTopics contains the topics for the uplink messages.

func (*UplinkTopics) Shutdown

func (ut *UplinkTopics) Shutdown(ctx context.Context) error

Shutdown shutdowns the active topics.

Directories

Path Synopsis
Package mock implements a mock pub/sub provider using the mempubsub driver.
Package mock implements a mock pub/sub provider using the mempubsub driver.
Package mqtt implements the MQTT provider using the mqtt driver.
Package mqtt implements the MQTT provider using the mqtt driver.
Package nats implements the NATS provider using the natspubsub driver.
Package nats implements the NATS provider using the natspubsub driver.

Jump to

Keyboard shortcuts

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