influxdb

package
v1.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2017 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Maximum time to try and connect to InfluxDB during startup.
	DefaultStartUpTimeout           = 5 * time.Minute
	DefaultSubscriptionSyncInterval = 1 * time.Minute

	DefaultSubscriptionProtocol = "http"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled  bool     `toml:"enabled" override:"enabled"`
	Name     string   `toml:"name" override:"name"`
	Default  bool     `toml:"default" override:"default"`
	URLs     []string `toml:"urls" override:"urls"`
	Username string   `toml:"username" override:"username"`
	Password string   `toml:"password" override:"password,redact"`
	// Path to CA file
	SSLCA string `toml:"ssl-ca" override:"ssl-ca"`
	// Path to host cert file
	SSLCert string `toml:"ssl-cert" override:"ssl-cert"`
	// Path to cert key file
	SSLKey string `toml:"ssl-key" override:"ssl-key"`
	// Use SSL but skip chain & host verification
	InsecureSkipVerify bool `toml:"insecure-skip-verify" override:"insecure-skip-verify"`

	Timeout                  toml.Duration       `toml:"timeout" override:"timeout"`
	DisableSubscriptions     bool                `toml:"disable-subscriptions" override:"disable-subscriptions"`
	SubscriptionProtocol     string              `toml:"subscription-protocol" override:"subscription-protocol"`
	SubscriptionMode         SubscriptionMode    `toml:"subscription-mode" override:"subscription-mode"`
	Subscriptions            map[string][]string `toml:"subscriptions" override:"subscriptions"`
	ExcludedSubscriptions    map[string][]string `toml:"excluded-subscriptions" override:"excluded-subscriptions"`
	KapacitorHostname        string              `toml:"kapacitor-hostname" override:"kapacitor-hostname"`
	HTTPPort                 int                 `toml:"http-port" override:"http-port"`
	UDPBind                  string              `toml:"udp-bind" override:"udp-bind"`
	UDPBuffer                int                 `toml:"udp-buffer" override:"udp-buffer"`
	UDPReadBuffer            int                 `toml:"udp-read-buffer" override:"udp-read-buffer"`
	StartUpTimeout           toml.Duration       `toml:"startup-timeout" override:"startup-timeout"`
	SubscriptionSyncInterval toml.Duration       `toml:"subscriptions-sync-interval" override:"subscriptions-sync-interval"`
}

func NewConfig

func NewConfig() Config

func (*Config) ApplyConditionalDefaults added in v1.1.0

func (c *Config) ApplyConditionalDefaults()

func (*Config) Init added in v1.1.0

func (c *Config) Init()

func (Config) Validate

func (c Config) Validate() error

type Diagnostic added in v1.4.0

type Diagnostic interface {
	WithClusterContext(cluster string) Diagnostic
	WithUDPContext(db string, rp string) udp.Diagnostic
	Error(msg string, err error, ctx ...keyvalue.T)

	InsecureSkipVerify(urls []string)
	UnlinkingSubscriptions(cluster string)
	LinkingSubscriptions(cluster string)
	StartedUDPListener(db string, rp string)
}

type IDer added in v1.4.0

type IDer interface {
	// ClusterID returns the current cluster ID, this ID may change.
	ClusterID() uuid.UUID
	// ServerID returns the server ID which does not change.
	ServerID() uuid.UUID
}

IDer returns the current IDs of the cluster and server.

type Service

type Service struct {

	// Wait for the cluster ID to change
	ClusterIDWaiter interface {
		Wait() bool
		Stop()
	}

	PointsWriter interface {
		WritePoints(database, retentionPolicy string, consistencyLevel models.ConsistencyLevel, points []models.Point) error
	}
	HTTPDService interface {
		AddRoutes([]httpd.Route) error
		DelRoutes([]httpd.Route)
	}
	ClientCreator interface {
		Create(influxdb.Config) (influxdb.ClientUpdater, error)
	}
	AuthService interface {
		GrantSubscriptionAccess(token, db, rp string) error
		ListSubscriptionTokens() ([]string, error)
		RevokeSubscriptionAccess(token string) error
	}
	RandReader io.Reader
	// contains filtered or unexported fields
}

Handles requests to write or read from an InfluxDB cluster

func NewService

func NewService(configs []Config, httpPort int, hostname string, ider IDer, useTokens bool, d Diagnostic) (*Service, error)

func (*Service) Close

func (s *Service) Close() error

func (*Service) LinkSubscriptions added in v1.0.0

func (s *Service) LinkSubscriptions() error

Trigger a LinkSubscriptions event for all clusters

func (*Service) NewNamedClient added in v0.11.0

func (s *Service) NewNamedClient(name string) (influxdb.Client, error)

NewNamedClient returns a new client for the given name or the default client if the name is empty.

func (*Service) Open

func (s *Service) Open() error

func (*Service) Test added in v1.1.0

func (s *Service) Test(options interface{}) error

func (*Service) TestOptions added in v1.1.0

func (s *Service) TestOptions() interface{}

func (*Service) Update added in v1.1.0

func (s *Service) Update(newConfigs []interface{}) error

type SubscriptionMode added in v1.4.0

type SubscriptionMode int
const (
	// ClusterMode means that there will be one set of subscriptions per cluster.
	ClusterMode SubscriptionMode = iota
	// ServerMode means that there will be one set of subscriptions per server.
	ServerMode
)

func (SubscriptionMode) MarshalText added in v1.4.0

func (m SubscriptionMode) MarshalText() ([]byte, error)

func (*SubscriptionMode) UnmarshalText added in v1.4.0

func (m *SubscriptionMode) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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