Documentation ¶
Index ¶
- Variables
- func CleanDownlinks(items []*ttnpb.ApplicationDownlink) []*ttnpb.ApplicationDownlink
- type ContextualApplicationUp
- type Server
- type Subscription
- func (s *Subscription) ApplicationIDs() *ttnpb.ApplicationIdentifiers
- func (s *Subscription) Context() context.Context
- func (s *Subscription) Disconnect(err error)
- func (s *Subscription) Protocol() string
- func (s *Subscription) Publish(ctx context.Context, up *ttnpb.ApplicationUp) error
- func (s *Subscription) Up() <-chan *ContextualApplicationUp
Constants ¶
This section is empty.
Variables ¶
var ( // DialTaskBackoffConfig derives the component.DialTaskBackoffConfig and dynamically determines the backoff duration // based on recent error codes. DialTaskBackoffConfig = &component.TaskBackoffConfig{ Jitter: component.DefaultTaskBackoffJitter, IntervalFunc: func(ctx context.Context, executionDuration time.Duration, invocation uint, err error) time.Duration { intervals := dialTaskBackoffIntervals switch { case errors.IsFailedPrecondition(err), errors.IsUnauthenticated(err), errors.IsPermissionDenied(err), errors.IsInvalidArgument(err), errors.IsAlreadyExists(err), errors.IsCanceled(err), errors.IsNotFound(err): intervals = dialTaskExtendedBackoffIntervals } switch { case executionDuration > component.DefaultTaskBackoffResetDuration: return intervals[0] case invocation >= uint(len(intervals)): return intervals[len(intervals)-1] default: return intervals[invocation-1] } }, } )
Functions ¶
func CleanDownlinks ¶
func CleanDownlinks(items []*ttnpb.ApplicationDownlink) []*ttnpb.ApplicationDownlink
CleanDownlinks returns a copy of the given downlink items with only the fields that can be set by the application.
Types ¶
type ContextualApplicationUp ¶
type ContextualApplicationUp struct { context.Context *ttnpb.ApplicationUp }
ContextualApplicationUp represents an ttnpb.ApplicationUp with its context.
type Server ¶
type Server interface { component.TaskStarter // GetBaseConfig returns the component configuration. GetBaseConfig(ctx context.Context) config.ServiceBase // FillContext fills the given context. // This method should only be used for request contexts. FillContext(ctx context.Context) context.Context // Publish publishes upstream traffic to the Application Server. Publish(ctx context.Context, up *ttnpb.ApplicationUp) error // Subscribe subscribes an application or integration by its identifiers to the Application Server, and returns a // Subscription for traffic and control. If the cluster parameter is true, the subscription receives all of the // traffic of the application. Otherwise, only traffic that was processed locally is sent. Subscribe(ctx context.Context, protocol string, ids *ttnpb.ApplicationIdentifiers, cluster bool) (*Subscription, error) // DownlinkQueuePush pushes the given downlink messages to the end device's application downlink queue. DownlinkQueuePush(context.Context, ttnpb.EndDeviceIdentifiers, []*ttnpb.ApplicationDownlink) error // DownlinkQueueReplace replaces the end device's application downlink queue with the given downlink messages. DownlinkQueueReplace(context.Context, ttnpb.EndDeviceIdentifiers, []*ttnpb.ApplicationDownlink) error // DownlinkQueueList lists the application downlink queue of the given end device. DownlinkQueueList(context.Context, ttnpb.EndDeviceIdentifiers) ([]*ttnpb.ApplicationDownlink, error) }
Server represents the Application Server to application frontends.
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
Subscription is a subscription to an application or integration managed by a frontend.
func NewSubscription ¶
func NewSubscription(ctx context.Context, protocol string, ids *ttnpb.ApplicationIdentifiers) *Subscription
NewSubscription instantiates a new application or integration subscription.
func (*Subscription) ApplicationIDs ¶
func (s *Subscription) ApplicationIDs() *ttnpb.ApplicationIdentifiers
ApplicationIDs returns the application identifiers, if the subscription represents any specific.
func (*Subscription) Context ¶
func (s *Subscription) Context() context.Context
Context returns the subscription context.
func (*Subscription) Disconnect ¶
func (s *Subscription) Disconnect(err error)
Disconnect marks the subscription as disconnected and cancels the context.
func (*Subscription) Protocol ¶
func (s *Subscription) Protocol() string
Protocol returns the protocol used for the subscription, i.e. grpc, mqtt or http.
func (*Subscription) Publish ¶ added in v3.11.0
func (s *Subscription) Publish(ctx context.Context, up *ttnpb.ApplicationUp) error
Publish publishes an upstream message. This method returns immediately, returning nil if the message is buffered, or with an error when the buffer is full.
func (*Subscription) Up ¶
func (s *Subscription) Up() <-chan *ContextualApplicationUp
Up returns the upstream channel.
Directories ¶
Path | Synopsis |
---|---|
Package mqtt implements the MQTT frontend.
|
Package mqtt implements the MQTT frontend. |
Package pubsub implements the go-cloud pub/sub frontend.
|
Package pubsub implements the go-cloud pub/sub frontend. |
provider/mock
Package mock implements a mock pub/sub provider using the mempubsub driver.
|
Package mock implements a mock pub/sub provider using the mempubsub driver. |
provider/mqtt
Package mqtt implements the MQTT provider using the mqtt driver.
|
Package mqtt implements the MQTT provider using the mqtt driver. |
provider/nats
Package nats implements the NATS provider using the natspubsub driver.
|
Package nats implements the NATS provider using the natspubsub driver. |
Package web implements the webhooks integration.
|
Package web implements the webhooks integration. |