temporal

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASC  = "asc"
	DESC = "desc"
)

Variables

View Source
var (
	ErrSeriesNotFound = errors.New("timeseries not found")
)

Functions

This section is empty.

Types

type Database

type Database interface {

	// Create a new bucket
	Create(name string) error

	// This function adds the records
	Add(name string, timeseries TimeSeries) error

	// Get the records
	Query(q Query) (timeSeries TimeSeries, nextEntry *int64, err error)

	QueryOnChannel(q Query) (timeseries <-chan TimeEntry, nextEntry chan *int64, err chan error)
	// Get the total pages for a particular query.
	// This helps for any client to call multiple queries
	GetPages(q Query) (seriesList []int64, count int, err error)

	// Get the records
	Get(series string) (timeSeries TimeSeries, err error)
	// Returns two channels, one for Time entries and one for error.
	// This avoids the usage of an extra buffer by the database
	// Caution: first read the channel and then read the error. Error channel shall be written only after the timeseries channel is closed
	GetOnChannel(series string) (timeseries <-chan TimeEntry, err chan error)

	// Delete a complete Series
	Delete(series string) error

	// Close the database
	Close() error
}

func Open

func Open(config interface{}) (Database, error)

type MemCacheConfig

type MemCacheConfig struct {
	Path string
	Mode os.FileMode
}

type MemCacheDB

type MemCacheDB struct {
	// contains filtered or unexported fields
}

func (MemCacheDB) Add

func (mem MemCacheDB) Add(name string, timeseries TimeSeries) error

func (MemCacheDB) Close

func (mem MemCacheDB) Close() error

func (MemCacheDB) Create

func (mem MemCacheDB) Create(name string) error

func (MemCacheDB) Delete

func (mem MemCacheDB) Delete(series string) error

func (MemCacheDB) Get

func (mem MemCacheDB) Get(series string) (TimeSeries, error)

func (MemCacheDB) GetOnChannel

func (mem MemCacheDB) GetOnChannel(series string) (<-chan TimeEntry, chan error)

func (MemCacheDB) GetPages

func (mem MemCacheDB) GetPages(q Query) ([]int64, int, error)

func (MemCacheDB) Query

func (mem MemCacheDB) Query(q Query) (timeSeries TimeSeries, nextEntry *int64, err error)

func (MemCacheDB) QueryOnChannel

func (mem MemCacheDB) QueryOnChannel(q Query) (<-chan TimeEntry, chan *int64, chan error)

type Query

type Query struct {
	Series string

	From int64
	To   int64
	// Sorting order:
	// Possible values are ASC and DESC
	// ASC : The time Series will have the oldest data first
	// DESC: The time Series will have the latest  data first.
	Sort string

	// Number of entries to be returned per page. This is used for pagination.
	// The next sequence is found out using NextEntry variable of a query response.
	MaxEntries int
}

type TimeEntry

type TimeEntry struct {
	Time  int64
	Value []byte
}

type TimeSeries

type TimeSeries []TimeEntry

Jump to

Keyboard shortcuts

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