etsz

package module
v0.0.0-...-4803122 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2018 License: MIT Imports: 3 Imported by: 0

README

etsz

Embedded golang time series database

Use with import "github.com/glaslos/etsz"

Create a new embedded db with edb := etsz.New()

Create entry: edb.Insert(1.0, "test") where "test" is the series name.

Read data: edb.Read("test") Example output:

[
  {
    "name": "test",
    "shards": [
      {
        "range": "20161014T14",
        "data": [
          {
            "date": 1476447064,
            "value": 1
}]}]}]

Series are split in shards with a currently hard-coded resolution of one hour (yolo).

range is the shard named by it's timestamp in hour resolution (yolo).

A shard contains data points consisting of unix timestamps (second resolution (yolo)) and values.

Shards are deleted on inserts if the shard is from the previous day (yolo).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EDB

type EDB struct {
	// DBList is the list of databases instanciated
	DBList map[string]map[string]*tsz.Series
}

EDB is an embedded time series database

func New

func New() EDB

New creates a new EDB instance

func (*EDB) Insert

func (edb *EDB) Insert(v float64, databaseName string) bool

Insert data into time series

func (*EDB) Read

func (edb *EDB) Read(databaseName string) Result

Read data from time series

func (*EDB) ReadAll

func (edb *EDB) ReadAll() []Result

ReadAll data from all time series

func (*EDB) ReadInt

func (edb *EDB) ReadInt(databaseName string) []int

ReadInt reads data from time series and returns an integer array TODO (glaslos): This is some ugly shit...

type Result

type Result struct {
	Name   string  `json:"name"`
	Shards []shard `json:"shards"`
}

Result from reading the time series

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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