pubsub

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: 20 Imported by: 0

Documentation

Overview

Package pubsub implements the go-cloud PubSub 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 PubSub 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 PubSub ID.

Types

type Format

type Format struct {
	formatters.Formatter
	Name string
}

Format is a format to use for PubSub integrations.

type PubSub

type PubSub struct {
	ttnpb.ApplicationPubSubRegistryServer

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

PubSub is an PubSub 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 PubSub integration by its identifiers.
	Get(ctx context.Context, ids ttnpb.ApplicationPubSubIdentifiers, paths []string) (*ttnpb.ApplicationPubSub, error)
	// Range ranges over the PubSub 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 PubSub integrations of the application.
	List(ctx context.Context, ids ttnpb.ApplicationIdentifiers, paths []string) ([]*ttnpb.ApplicationPubSub, error)
	// Set creates, updates or deletes the PubSub 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 PubSub integrations.

Directories

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