database

package
v0.0.0-...-94c576c Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package database implements functions to store information in Cloud Spanner databases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(ctx context.Context, db string) (bool, error)

Exists returns true if the database given by the string exists on Cloud Spanner.

func LoadDatabase

func LoadDatabase(ctx context.Context, config *Config) (*database, error)

LoadDatabase sets up clients with already existing database in Cloud Spanner.

func NewDatabase

func NewDatabase(ctx context.Context, config *Config) (*database, error)

NewDatabase creates a new database on Cloud Spanner at the provided string.

Types

type Config

type Config struct {
	Database string
	Workers  int
	Metrics  *DBMetrics
}

Config gets passed to functions that start TrueStreet's connection with Spanner.

type DBMetrics

type DBMetrics struct {
	SpannerDuration map[string]prometheus.Histogram
	SpannerErrors   map[string]prometheus.Counter
	Samples         map[string]prometheus.Summary
}

DBMetrics stores prometheus metrics to record data about the database. SpannerDuration and SpannerError metrics should be stored as "write" and "read" in the maps.

type Database

type Database interface {
	Write(ctx context.Context, ts *TimeSeries) error
	Read(ctx context.Context, queries []*prompb.Query) (*prompb.ReadResponse, error)
	Close()
}

Database interface for the external functions of truestreet.

type Sample

type Sample struct {
	TSID      model.Fingerprint
	Timestamp model.Time
	Value     model.SampleValue
}

Sample struct stores a single sample with the TSID identifier rather than the metric map.

type TimeSeries

type TimeSeries struct {
	Metrics []model.Metric
	Samples []*Sample
}

TimeSeries struct for storing protobuf timeSeries data using prometheus model structs.

Jump to

Keyboard shortcuts

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