Documentation ¶
Index ¶
- func BytesToFloat(data []byte) float64
- func FloatToBytes(value float64) []byte
- type BoltStorage
- func (store *BoltStorage) AddValue(key string, value float64) error
- func (store *BoltStorage) Close() error
- func (store *BoltStorage) Delete(key string) error
- func (store *BoltStorage) DeleteRange(key string, from time.Time, to time.Time) error
- func (store *BoltStorage) Get(key string) ([]byte, error)
- func (store *BoltStorage) GetRange(key string, from time.Time, to time.Time) (chan *TimeSeriesEntry, error)
- func (store *BoltStorage) Put(key string, value []byte) error
- type KeyValueStorage
- type LevelDBStorage
- func (store *LevelDBStorage) AddValue(key string, value float64) error
- func (store *LevelDBStorage) Close() error
- func (store *LevelDBStorage) Delete(key string) error
- func (store *LevelDBStorage) DeleteRange(key string, from time.Time, to time.Time) error
- func (store *LevelDBStorage) Get(key string) ([]byte, error)
- func (store *LevelDBStorage) GetRange(key string, from time.Time, to time.Time) (chan *TimeSeriesEntry, error)
- func (store *LevelDBStorage) Put(key string, value []byte) error
- type MetaStorage
- func (store *MetaStorage) AddValue(key string, value float64) error
- func (store *MetaStorage) Close() error
- func (store *MetaStorage) Delete(key string) error
- func (store *MetaStorage) DeleteRange(key string, from time.Time, to time.Time) error
- func (store *MetaStorage) Get(key string) ([]byte, error)
- func (store *MetaStorage) GetRange(key string, from time.Time, to time.Time) (chan *TimeSeriesEntry, error)
- func (store *MetaStorage) Put(key string, value []byte) error
- type MongoStorage
- func (store *MongoStorage) AddValue(key string, value float64) error
- func (store *MongoStorage) Close() error
- func (store *MongoStorage) Delete(key string) error
- func (store *MongoStorage) DeleteRange(key string, from time.Time, to time.Time) error
- func (store *MongoStorage) Get(key string) ([]byte, error)
- func (store *MongoStorage) GetRange(key string, from time.Time, to time.Time) (chan *TimeSeriesEntry, error)
- func (store *MongoStorage) Put(key string, value []byte) error
- type Storage
- type TimeSeriesEntry
- type TimeSeriesStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToFloat ¶
BytesToFloat converts a slice of bytes to a float
func FloatToBytes ¶
FloatToBytes converts a float64 to bytes
Types ¶
type BoltStorage ¶
type BoltStorage struct {
// contains filtered or unexported fields
}
BoltStorage is an implementation for KeyValueStorage and TimeSeriesStorage
func (*BoltStorage) AddValue ¶
func (store *BoltStorage) AddValue(key string, value float64) error
AddValue saves a value to the given timeseries
func (*BoltStorage) Close ¶
func (store *BoltStorage) Close() error
Close closes the db, flushing it eventually
func (*BoltStorage) Delete ¶
func (store *BoltStorage) Delete(key string) error
Delete drops an entry from db
func (*BoltStorage) DeleteRange ¶
DeleteRange deletes a range from a timeseries
func (*BoltStorage) Get ¶
func (store *BoltStorage) Get(key string) ([]byte, error)
Get retrieves a value from db
func (*BoltStorage) GetRange ¶
func (store *BoltStorage) GetRange(key string, from time.Time, to time.Time) (chan *TimeSeriesEntry, error)
GetRange returns a channel which will give all values in a timerange
type KeyValueStorage ¶
type KeyValueStorage interface { Put(key string, value []byte) error Get(key string) ([]byte, error) Delete(key string) error }
KeyValueStorage is the interface for key-value-storage backends
type LevelDBStorage ¶
type LevelDBStorage struct {
// contains filtered or unexported fields
}
LevelDBStorage is an implementation for KeyValueStorage and TimeSeriesStorage
func NewLevelDBStorage ¶
func NewLevelDBStorage(path string) (*LevelDBStorage, error)
NewLevelDBStorage creates a new storage instance
func (*LevelDBStorage) AddValue ¶
func (store *LevelDBStorage) AddValue(key string, value float64) error
AddValue saves a value to the given timeseries
func (*LevelDBStorage) Close ¶
func (store *LevelDBStorage) Close() error
Close closes the db, flushing it eventually
func (*LevelDBStorage) Delete ¶
func (store *LevelDBStorage) Delete(key string) error
Delete drops an entry from db
func (*LevelDBStorage) DeleteRange ¶
func (*LevelDBStorage) Get ¶
func (store *LevelDBStorage) Get(key string) ([]byte, error)
Get retrieves a value from db
func (*LevelDBStorage) GetRange ¶
func (store *LevelDBStorage) GetRange(key string, from time.Time, to time.Time) (chan *TimeSeriesEntry, error)
GetRange returns a channel which will give all values in a timerange
type MetaStorage ¶
type MetaStorage struct {
// contains filtered or unexported fields
}
MetaStorage wraps a specific storage
func (*MetaStorage) Close ¶
func (store *MetaStorage) Close() error
func (*MetaStorage) Delete ¶
func (store *MetaStorage) Delete(key string) error
func (*MetaStorage) DeleteRange ¶
func (*MetaStorage) GetRange ¶
func (store *MetaStorage) GetRange(key string, from time.Time, to time.Time) (chan *TimeSeriesEntry, error)
type MongoStorage ¶
type MongoStorage struct {
// contains filtered or unexported fields
}
MongoStorage is an implementation for KeyValueStorage and TimeSeriesStorage
func (*MongoStorage) AddValue ¶
func (store *MongoStorage) AddValue(key string, value float64) error
AddValue adds a value to a timeseries
func (*MongoStorage) Delete ¶
func (store *MongoStorage) Delete(key string) error
Delete drops an entry from db
func (*MongoStorage) DeleteRange ¶
DeleteRange returns a aspecific range in a timeseries
func (*MongoStorage) Get ¶
func (store *MongoStorage) Get(key string) ([]byte, error)
Get retrieves a doc from the db
func (*MongoStorage) GetRange ¶
func (store *MongoStorage) GetRange(key string, from time.Time, to time.Time) (chan *TimeSeriesEntry, error)
GetRange returns a aspecific range in a timeseries
type Storage ¶
type Storage interface { KeyValueStorage TimeSeriesStorage Close() error }
Storage is a combined interface of KeyValueStorage and TimeSeriesStorage
func NewBoltStorage ¶
NewBoltStorage creates a new storage instance
func NewMetaStorage ¶
NewMetaStorage returns a new Storage object with the correct implementation for the given URI
func NewMongoStorage ¶
NewMongoStorage creates a new storage with mongodb as its backend
type TimeSeriesEntry ¶
A TimeSeriesEntry is a single entry of a timeseries
type TimeSeriesStorage ¶
type TimeSeriesStorage interface { AddValue(key string, value float64) error GetRange(key string, from time.Time, to time.Time) (chan *TimeSeriesEntry, error) DeleteRange(key string, from time.Time, to time.Time) error }
TimeSeriesStorage is the interface for timeseries handling