provider

package
v0.0.0-...-5352646 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: Apache-2.0 Imports: 6 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 PubSub 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 Provider

type Provider interface {
	// OpenConnection opens the Connection of a given Target.
	OpenConnection(ctx context.Context, target Target) (*Connection, error)
}

Provider represents a PubSub 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 {
	GetProvider() ttnpb.ApplicationPubSub_Provider

	GetBaseTopic() string
	GetDownlinkPush() *ttnpb.ApplicationPubSub_Message
	GetDownlinkReplace() *ttnpb.ApplicationPubSub_Message
	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
	GetLocationSolved() *ttnpb.ApplicationPubSub_Message
}

Target represents settings for a PubSub provider to connect.

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
	LocationSolved *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 PubSub provider using the mempubsub driver.
Package mock implements a mock PubSub 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