store

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cache implements a cache for time series data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimePoint

type TimePoint struct {
	Timestamp time.Time
	Value     interface{}
}

TimePoint is a single point of a timeseries, representing a time-value pair.

type TimeStore

type TimeStore interface {
	// Put stores a TimePoint to the TimeStore. Returns error upon failure.
	// Ignores zero timestamps.
	Put(tp TimePoint) error
	// Get returns a slice of elements that were previously stored with timestamps
	// between 'start' and 'end'. 'start' is expected to be before 'end'.
	// If 'start' is zero, it returns all the elements up until 'end'.
	// If 'end' is zero, it returns all the elements from 'start'.
	// If both 'start' and 'end' are zero, it returns all the elements in the store.
	// Note: Returns data in reverse chronological order -
	// Latest element will be the first element in the slice.
	Get(start, end time.Time) []TimePoint
	// Delete removes all elements that were previously stored with timestamps
	// between 'start' and 'end'.
	Delete(start, end time.Time) error
}

TimeStore represents a timeseries storage. Implementations are expected to be thread safe.

func NewCMAStore added in v0.16.0

func NewCMAStore() TimeStore

func NewGCStore

func NewGCStore(store TimeStore, bufferDuration time.Duration) TimeStore

func NewTimeStore

func NewTimeStore() TimeStore

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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