Documentation ¶
Overview ¶
Package influxdb2robust provides a variant of the standard influxdb2 go client library (https://github.com/influxdata/influxdb-client-go) which buffers new data in a local BoltDB database so that we can safely collect data and upload it to a remote InfluxDB v2 instance despite a bad network connection.
Index ¶
- type InfluxDBRobustClient
- func (c *InfluxDBRobustClient) AuthorizationsApi() api.AuthorizationsApi
- func (c *InfluxDBRobustClient) Close()
- func (c *InfluxDBRobustClient) Options() *influxdb2.Options
- func (c *InfluxDBRobustClient) OrganizationsApi() api.OrganizationsApi
- func (c *InfluxDBRobustClient) QueryApi(org string) influxdb2.QueryApi
- func (c *InfluxDBRobustClient) Ready(ctx context.Context) (bool, error)
- func (c *InfluxDBRobustClient) ServerUrl() string
- func (c *InfluxDBRobustClient) Setup(ctx context.Context, username, password, org, bucket string, ...) (*domain.OnboardingResponse, error)
- func (c *InfluxDBRobustClient) UsersApi() api.UsersApi
- func (c *InfluxDBRobustClient) WriteApi(org, bucket, filename string) (influxdb2.WriteApi, error)
- func (c *InfluxDBRobustClient) WriteApiBlocking(org, bucket string) influxdb2.WriteApiBlocking
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InfluxDBRobustClient ¶
type InfluxDBRobustClient struct { BaseClient influxdb2.InfluxDBClient // contains filtered or unexported fields }
InfluxDBRobustClient implements the API to communicate with an InfluxDBServer There two APIs for writing, WriteApi and WriteApiBlocking. WriteApi provides asynchronous, non-blocking, methods for writing time series data, and uses the robust Boltdb buffer. WriteApiBlocking provides blocking methods for writing time series data and does not use the buffer.
func NewClient ¶
func NewClient(serverUrl string, authToken string) *InfluxDBRobustClient
NewClient creates Client for connecting to given serverUrl with provided authentication token, with the default options. Authentication token can be empty in case of connecting to newly installed InfluxDB server, which has not been set up yet. In such case Setup will set authentication token
func NewClientWithOptions ¶
func NewClientWithOptions(serverUrl string, authToken string, options *influxdb2.Options) *InfluxDBRobustClient
NewClientWithOptions creates Client for connecting to given serverUrl with provided authentication token and configured with custom Options Authentication token can be empty in case of connecting to newly installed InfluxDB server, which has not been set up yet. In such case Setup will set authentication token
func (*InfluxDBRobustClient) AuthorizationsApi ¶
func (c *InfluxDBRobustClient) AuthorizationsApi() api.AuthorizationsApi
AuthorizationsApi returns Authorizations API client
func (*InfluxDBRobustClient) Close ¶
func (c *InfluxDBRobustClient) Close()
Close ensures all ongoing asynchronous write clients finish
func (*InfluxDBRobustClient) Options ¶
func (c *InfluxDBRobustClient) Options() *influxdb2.Options
Options returns the options associated with client
func (*InfluxDBRobustClient) OrganizationsApi ¶
func (c *InfluxDBRobustClient) OrganizationsApi() api.OrganizationsApi
OrganizationsApi returns Organizations API client
func (*InfluxDBRobustClient) QueryApi ¶
func (c *InfluxDBRobustClient) QueryApi(org string) influxdb2.QueryApi
QueryApi returns Query client
func (*InfluxDBRobustClient) Ready ¶
func (c *InfluxDBRobustClient) Ready(ctx context.Context) (bool, error)
Ready checks InfluxDB server is running
func (*InfluxDBRobustClient) ServerUrl ¶
func (c *InfluxDBRobustClient) ServerUrl() string
ServerUrl returns the url of the server url client talks to
func (*InfluxDBRobustClient) Setup ¶
func (c *InfluxDBRobustClient) Setup(ctx context.Context, username, password, org, bucket string, retentionPeriodHours int) (*domain.OnboardingResponse, error)
Setup sends request to initialise new InfluxDB server with user, org and bucket, and data retention period Retention period of zero will result to infinite retention and returns details about newly created entities along with the authorization object
func (*InfluxDBRobustClient) UsersApi ¶
func (c *InfluxDBRobustClient) UsersApi() api.UsersApi
UsersApi returns Users API client
func (*InfluxDBRobustClient) WriteApi ¶
func (c *InfluxDBRobustClient) WriteApi(org, bucket, filename string) (influxdb2.WriteApi, error)
WriteApi returns the asynchronous, non-blocking, Write client. This is the only method which is implemented differently in the "robust" version. Note the extra `filename` argument, and that it can return an error.
func (*InfluxDBRobustClient) WriteApiBlocking ¶
func (c *InfluxDBRobustClient) WriteApiBlocking(org, bucket string) influxdb2.WriteApiBlocking
WriteApiBlocking returns the synchronous, blocking, Write client. We allow direct access to the underlying blocking client - blocking writes will tell the caller that the write failed, so we don't need the magic persistent buffer.