source

package
v0.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlagSet

func FlagSet() *pflag.FlagSet

FlagSet returns flags for all configured sources.

func RegisterSource

func RegisterSource(r Registration) error

RegisterSource registers a new Source.

func Sources

func Sources() map[string]string

Sources returns a map of registered Sources and their descriptions.

Types

type CreateSource

type CreateSource func(ctx context.Context, flags *pflag.FlagSet) (Source, error)

CreateSource is a function that constructs a new Source.

type Registration

type Registration struct {
	Name,
	Description string

	Create  CreateSource
	FlagSet *pflag.FlagSet
}

Registration contains information for a registered Source.

type Source

type Source interface {
	// ExportDevice retrieves an end device from the source and returns it as a ttnpb.EndDevice.
	ExportDevice(devID string) (*ttnpb.EndDevice, error)
	// RangeDevices calls a function for all matching devices of an application.
	RangeDevices(appID string, f func(s Source, devID string) error) error
	// Close cleans up and terminates any open connections.
	Close() error
}

Source is a source for end devices.

func NewSource

func NewSource(ctx context.Context, flags *pflag.FlagSet) (Source, error)

NewSource creates a new Source from parsed flags.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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