distribution

package
v3.15.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Distributor

type Distributor interface {
	// Publish publishes traffic to the subscribers.
	Publish(context.Context, *ttnpb.ApplicationUp) error
	// Subscribe to the traffic of a specific application.
	Subscribe(context.Context, string, *ttnpb.ApplicationIdentifiers) (*io.Subscription, error)
}

Distributor sends upstream traffic from publishers to subscribers.

func NewLocalDistributor

func NewLocalDistributor(ctx context.Context, rd RequestDecoupler, timeout time.Duration) Distributor

NewLocalDistributor creates a Distributor that routes the traffic locally. The underlying subscription sets can timeout if there are no active subscribers. A timeout of 0 means the underlying subscriptions never timeout.

func NewPubSubDistributor

func NewPubSubDistributor(ctx context.Context, rd RequestDecoupler, timeout time.Duration, pubsub PubSub) Distributor

NewPubSubDistributor creates a Distributor on top of the provided PubSub. The underlying subscription sets can timeout if there are no active subscribers. A timeout of 0 means the underlying subscription sets never timeout.

type PubSub

type PubSub interface {
	// Publish publishes traffic to the subscribers.
	Publish(context.Context, *ttnpb.ApplicationUp) error
	// Subscribe to the traffic of a specific application.
	Subscribe(context.Context, ttnpb.ApplicationIdentifiers, func(context.Context, *ttnpb.ApplicationUp) error) error
}

PubSub sends upstream traffic from publishers to subscribers.

type RequestDecoupler

type RequestDecoupler interface {
	FromRequestContext(ctx context.Context) context.Context
}

RequestDecoupler decouples the security information found in a context from the lifetime of the context.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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