Documentation ¶
Overview ¶
Package pubsub implements the go-cloud pub/sub frontend.
Index ¶
- func PubSubUID(appUID, id string) string
- func SplitPubSubUID(uid string) (appUID string, id string)
- type Format
- type ProviderStatus
- type ProviderStatuses
- type PubSub
- func (ps *PubSub) Delete(ctx context.Context, ids *ttnpb.ApplicationPubSubIdentifiers) (*pbtypes.Empty, error)
- func (ps *PubSub) Get(ctx context.Context, req *ttnpb.GetApplicationPubSubRequest) (*ttnpb.ApplicationPubSub, error)
- func (ps *PubSub) GetFormats(ctx context.Context, _ *pbtypes.Empty) (*ttnpb.ApplicationPubSubFormats, error)
- func (ps *PubSub) List(ctx context.Context, req *ttnpb.ListApplicationPubSubsRequest) (*ttnpb.ApplicationPubSubs, error)
- func (ps *PubSub) Set(ctx context.Context, req *ttnpb.SetApplicationPubSubRequest) (*ttnpb.ApplicationPubSub, error)
- type Registry
- type RegistryCleaner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PubSubUID ¶
PubSubUID generates an unique ID based on an application unique ID and a pub/sub ID.
func SplitPubSubUID ¶
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 ProviderStatus ¶ added in v3.11.0
type ProviderStatus int
ProviderStatus is the status of a PubSub provider.
type ProviderStatuses ¶ added in v3.11.0
type ProviderStatuses map[reflect.Type]ProviderStatus
ProviderStatuses maps a provider type to a provider status.
func ProviderStatusesFromMap ¶ added in v3.11.0
ProviderStatusesFromMap constructs the provider statuses from the provided map.
func (ProviderStatuses) Enabled ¶ added in v3.11.0
func (ps ProviderStatuses) Enabled(ctx context.Context, provider ttnpb.ApplicationPubSub_Provider) error
Enabled checks if the provided provider is enabled. Providers which are not specified in the map are considered to be enabled by default.
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, providerStatuses ProviderStatuses) (*PubSub, error)
New creates a new pusub frontend.
func (*PubSub) Delete ¶
func (ps *PubSub) Delete(ctx context.Context, ids *ttnpb.ApplicationPubSubIdentifiers) (*pbtypes.Empty, error)
Delete implements ttnpb.ApplicationPubSubRegistryServer.
func (*PubSub) Get ¶
func (ps *PubSub) Get(ctx context.Context, req *ttnpb.GetApplicationPubSubRequest) (*ttnpb.ApplicationPubSub, error)
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 ¶
func (ps *PubSub) List(ctx context.Context, req *ttnpb.ListApplicationPubSubsRequest) (*ttnpb.ApplicationPubSubs, error)
List implements ttnpb.ApplicationPubSubRegistryServer.
func (*PubSub) Set ¶
func (ps *PubSub) Set(ctx context.Context, req *ttnpb.SetApplicationPubSubRequest) (*ttnpb.ApplicationPubSub, error)
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.
type RegistryCleaner ¶ added in v3.15.2
RegistryCleaner is a service responsible for cleanup of the PubSub registry.
func (*RegistryCleaner) CleanData ¶ added in v3.15.2
func (cleaner *RegistryCleaner) CleanData(ctx context.Context, isSet map[string]struct{}) error
CleanData cleans registry application data.
func (*RegistryCleaner) DeleteApplicationData ¶ added in v3.15.2
func (cleaner *RegistryCleaner) DeleteApplicationData(ctx context.Context, applicationList []string) error
DeleteApplicationData deletes registry application data of all applications in the application list.
func (*RegistryCleaner) RangeToLocalSet ¶ added in v3.15.2
func (cleaner *RegistryCleaner) RangeToLocalSet(ctx context.Context) error
RangeToLocalSet returns a set of applications that have data in the registry.
Source Files ¶
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. |