influxdb

package
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Org    NameOrID
	Bucket NameOrID
	Host   string
	Token  string
}

Config contains the common configuration for interacting with an influxdb instance.

type Dependency

type Dependency struct {
	Provider Provider
}

Dependency will inject the Provider into the dependency chain.

func (Dependency) Inject

func (d Dependency) Inject(ctx context.Context) context.Context

Inject will inject the Provider into the dependency chain.

type HttpClient

type HttpClient struct {
	Client http.Client
	Config Config
}

HttpClient is an http client for reading from an influxdb instance.

func (*HttpClient) Query

func (h *HttpClient) Query(ctx context.Context, f func(table flux.Table) error, file *ast.File, now time.Time, mem memory.Allocator) error

Query will create a new http.Request, send it to the server, then decode the request as a flux.TableIterator and invoke the function with each flux.Table.

type HttpProvider

type HttpProvider struct {
	DefaultConfig Config
}

HttpProvider is an implementation of the Provider that implements the read methods with HTTP calls to an influxdb query endpoint.

func (HttpProvider) ReaderFor

func (h HttpProvider) ReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

func (HttpProvider) SeriesCardinalityReaderFor

func (h HttpProvider) SeriesCardinalityReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

type NameOrID

type NameOrID struct {
	ID   string
	Name string
}

NameOrID signifies the name of an organization/bucket or an ID for an organization/bucket.

func (NameOrID) IsValid

func (n NameOrID) IsValid() bool

IsValid will return true if both the name and the id are not set at the same time.

func (NameOrID) IsZero

func (n NameOrID) IsZero() bool

IsZero will return true if neither the id nor name are set.

type Predicate

type Predicate struct {
	interpreter.ResolvedFunction

	// KeepEmpty determines if empty tables should be retained
	// if none of the rows pass the filter.
	KeepEmpty bool
}

Predicate defines a predicate to filter storage with.

func (*Predicate) Copy

func (p *Predicate) Copy() Predicate

Copy produces a deep copy of the Predicate.

type PredicateSet

type PredicateSet []Predicate

PredicateSet holds a set of predicates that will filter the results.

func (PredicateSet) Copy

func (ps PredicateSet) Copy() PredicateSet

Copy produces a deep copy of the PredicateSet.

type Provider

type Provider interface {
	// ReaderFor will construct a Reader using the given configuration parameters.
	// If the parameters are their zero values, appropriate defaults may be used
	// or an error may be returned if the implementation does not have a default.
	ReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

	// SeriesCardinalityReaderFor will return a Reader
	// for the SeriesCardinality operation.
	SeriesCardinalityReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)
}

Provider is an interface for creating a Reader that will read data from an influxdb instance.

This provides different provider methods depending on the read method. The read methods can be expanded so implementors of this interface should embed the UnimplementedProvider to automatically implement new methods with a default unimplemented stub.

func GetProvider

func GetProvider(ctx context.Context) Provider

GetProvider will return the Provider for the current context. If no Provider has been injected into the dependencies, this will return a default provider.

type Reader

type Reader interface {
	// Read will produce flux.Table values using the memory.Allocator
	// and it will pass those tables to the given function.
	Read(ctx context.Context, f func(flux.Table) error, mem memory.Allocator) error
}

Reader reads tables from an influxdb instance.

type UnimplementedProvider

type UnimplementedProvider struct{}

UnimplementedProvider provides default implementations for a Provider. This implements all of the Provider methods by returning an error with the code codes.Unimplemented.

func (UnimplementedProvider) ReaderFor

func (u UnimplementedProvider) ReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

func (UnimplementedProvider) SeriesCardinalityReaderFor

func (u UnimplementedProvider) SeriesCardinalityReaderFor(ctx context.Context, conf Config, bounds flux.Bounds, predicateSet PredicateSet) (Reader, error)

Jump to

Keyboard shortcuts

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