db

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package db contains functions for communication with an InfluxDB host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRound added in v0.5.0

func AddRound(r game.RoundInfo)

AddRound adds a game round to the buffer to be pushed to the InfluxDB when possible.

Types

type ConnectOpts

type ConnectOpts struct {
	URL    string
	Token  string
	Org    string
	Bucket string
}

ConnectOpts allows defining options for a new client.

type ConnectionDetails

type ConnectionDetails struct {
	Name    string
	Version string
	Commit  string
}

ConnectionDetails contains details about the connection to an InfluxDB host.

type InfluxClient

type InfluxClient struct {
	URL string
	// contains filtered or unexported fields
}

InfluxClient is used to send R6 round data to an InfluxDB host.

func NewInfluxClient

func NewInfluxClient(opts ConnectOpts) *InfluxClient

NewInfluxClient creates a new client with the provided options.

func (*InfluxClient) Close

func (c *InfluxClient) Close()

Close calls the client's underlying Close function, finishing all asynchronous writes.

func (*InfluxClient) LoopAsync added in v0.5.0

func (c *InfluxClient) LoopAsync() <-chan InfluxEvent

LoopAsync starts a goroutine which pushes the data from the queue iteratively (FIFO) to the InfluxDB. It returns a channel used for providing event information.

func (*InfluxClient) ValidateConn

func (c *InfluxClient) ValidateConn(timeout time.Duration) (details *ConnectionDetails, err error)

ValidateConn validates that the InfluxDB host can be reached, is healthy and that the client has write permissions.

type InfluxEvent added in v0.5.0

type InfluxEvent struct {
	Err        error
	MatchID    string
	RoundIndex int
}

InfluxEvent contains data sent from the asynchronous loop started by LoopAsync. It contains the MatchID and RoundIndex for the related event and an Err field indicating success if nil.

Jump to

Keyboard shortcuts

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