database

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2018 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Adapters = map[string]Connect{}

Adapters is the list of registered database adapters

Functions

func RegisterAdapter

func RegisterAdapter(name string, n Connect)

Types

type Config

type Config struct {
	DeleteInterval duration.Duration `toml:"delete_interval"` // Delete stats of nodes every n minutes
	DeleteAfter    duration.Duration `toml:"delete_after"`    // Delete stats of nodes till now-deletetill n minutes
	Connection     map[string]interface{}
}

type Connect

type Connect func(config map[string]interface{}) (Connection, error)

Connect function with config to get DB connection interface

type Connection

type Connection interface {
	// InsertNode stores statistics per node
	InsertNode(node *runtime.Node)

	// InsertLink stores statistics per link
	InsertLink(*runtime.Link, time.Time)

	// InsertGlobals stores global statistics
	InsertGlobals(*runtime.GlobalStats, time.Time, string, string)

	// PruneNodes prunes historical per-node data
	PruneNodes(deleteAfter time.Duration)

	// Close closes the database connection
	Close()
}

Connection interface to use for implementation in e.g. influxdb

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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