source

package
v0.9.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotRegistered     = errors.DefineInvalidArgument("not_registered", "source `{source}` is not registered")
	ErrAlreadyRegistered = errors.DefineInvalidArgument("already_registered", "source `{source}` is already registered")
	ErrNoSource          = errors.DefineInvalidArgument("no_source", "no source")
)

Functions

func AllFlagSets added in v0.9.0

func AllFlagSets() *pflag.FlagSet

AllFlagSets returns flags for all configured sources prefixed with source names.

func FlagSet

func FlagSet(s string) (*pflag.FlagSet, error)

FlagSet returns a flag set for a given source.

func Names added in v0.9.0

func Names() []string

Names returns a slice of registered Sources names.

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 Config added in v0.9.0

type Config struct {
	DryRun, Verbose   bool
	FrequencyPlansURL string
	// contains filtered or unexported fields
}
var RootConfig Config

func (*Config) SetSource added in v0.9.0

func (c *Config) SetSource(s string) bool

func (*Config) Source added in v0.9.0

func (c *Config) Source() string

type CreateSource

type CreateSource func(ctx context.Context, rootCfg Config) (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) (Source, error)

NewSource creates a new Source from parsed flags.

Directories

Path Synopsis
tts
api

Jump to

Keyboard shortcuts

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