pubsub

package
v3.10.10 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package pubsub implements the go-cloud pub/sub frontend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PubSubUID

func PubSubUID(appUID, id string) string

PubSubUID generates an unique ID based on an application unique ID and a pub/sub ID.

func SplitPubSubUID

func SplitPubSubUID(uid string) (string, string)

SplitPubSubUID parses a unique ID generated by `ID` and returns the application unique ID and the pub/sub ID.

Types

type Format

type Format struct {
	formatters.Formatter
	Name string
}

Format is a format to use for pub/sub integrations.

type PubSub

type PubSub struct {
	ttnpb.ApplicationPubSubRegistryServer

	*component.Component
	// contains filtered or unexported fields
}

PubSub is an pub/sub frontend that exposes ttnpb.ApplicationPubSubRegistryServer.

func New

func New(c *component.Component, server io.Server, registry Registry) (*PubSub, error)

New creates a new pusub frontend.

func (*PubSub) Delete

Delete implements ttnpb.ApplicationPubSubRegistryServer.

func (*PubSub) Get

Get implements ttnpb.ApplicationPubSubRegistryServer.

func (*PubSub) GetFormats

func (ps *PubSub) GetFormats(ctx context.Context, _ *pbtypes.Empty) (*ttnpb.ApplicationPubSubFormats, error)

GetFormats implements ttnpb.ApplicationPubSubRegistryServer.

func (*PubSub) List

List implements ttnpb.ApplicationPubSubRegistryServer.

func (*PubSub) Set

Set implements ttnpb.ApplicationPubSubRegistryServer.

type Registry

type Registry interface {
	// Get returns the pub/sub integration by its identifiers.
	Get(ctx context.Context, ids ttnpb.ApplicationPubSubIdentifiers, paths []string) (*ttnpb.ApplicationPubSub, error)
	// Range ranges over the pub/sub integrations and calls the callback function, until false is returned.
	Range(ctx context.Context, paths []string, f func(context.Context, ttnpb.ApplicationIdentifiers, *ttnpb.ApplicationPubSub) bool) error
	// List returns all pub/sub integrations of the application.
	List(ctx context.Context, ids ttnpb.ApplicationIdentifiers, paths []string) ([]*ttnpb.ApplicationPubSub, error)
	// Set creates, updates or deletes the pub/sub integration by its identifiers.
	Set(ctx context.Context, ids ttnpb.ApplicationPubSubIdentifiers, paths []string, f func(*ttnpb.ApplicationPubSub) (*ttnpb.ApplicationPubSub, []string, error)) (*ttnpb.ApplicationPubSub, error)
}

Registry is a registry for pub/sub integrations.

Directories

Path Synopsis
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.
mqtt
Package mqtt implements the MQTT provider using the mqtt driver.
Package mqtt implements the MQTT provider using the mqtt driver.
nats
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