storage

package
v0.0.0-...-5da7e01 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeReadWriter

type FakeReadWriter struct {
	ReadWriter
	FakeFetch        func(name string, start, end time.Time) (model.SeriesSlice, error)
	FakeInsertMetric func(*model.Metric) error
}

FakeReadWriter is for stub testing

func (*FakeReadWriter) Fetch

func (s *FakeReadWriter) Fetch(name string, start, end time.Time) (model.SeriesSlice, error)

func (*FakeReadWriter) InsertMetric

func (r *FakeReadWriter) InsertMetric(m *model.Metric) error

type ReadWriter

type ReadWriter interface {
	Ping() error
	Init() error
	Fetch(string, time.Time, time.Time) (model.SeriesSlice, error)
	InsertMetric(*model.Metric) error
}

ReadWriter defines the interface for data store reader and writer.

type Store

type Store struct {
	Redis    redis.ReadWriter
	DynamoDB dynamodb.ReadWriter
}

Store provides each data store client.

func New

func New() (*Store, error)

New create a new Store wrapped by ReadWriter.

func (*Store) Fetch

func (s *Store) Fetch(name string, start, end time.Time) (model.SeriesSlice, error)

Fetch fetches series from Redis, DynamoDB and S3. TODO S3

func (*Store) Init

func (s *Store) Init() error

Init initializes the store object.

func (*Store) InsertMetric

func (s *Store) InsertMetric(m *model.Metric) error

InsertMetric inserts datapoints to Redis with rollup aggregation to DynamoDB if needed.

func (*Store) Ping

func (s *Store) Ping() error

Ping pings each storage.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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