sopdb

package
v0.0.0-...-c1b23f5 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is the generic error value to indicate absence of things
	// asked for.
	ErrNotFound = errors.New("not found")

	ErrBadMetric = errors.New("bad metric")

	ErrBadSample = errors.New("bad sample(s)")
)

Functions

This section is empty.

Types

type DB

type DB interface {
	Index() IndexDB
	Latest() LatestDB
	TS() TSDB
	Close() error
}

DB is the main storage interface.

type Downsampler

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

func NewDownsampler

func NewDownsampler(db DB, dur, ttl time.Duration, outputs []output.Output) *Downsampler

func (*Downsampler) Start

func (d *Downsampler) Start()

func (*Downsampler) Stop

func (d *Downsampler) Stop()

type IndexDB

type IndexDB interface {
	// Query returns the ids of the series that match the given expression.
	Query(expr model.LabelExpr) (ids []int, err error)

	// Make gets the id of the series identified by the given fully-qualified
	// metric. If the series does not exist, it is created and a new id is
	// returned.
	Make(metric model.Metric) (id int, err error)

	// Lookup
	Lookup(id int) (metric model.Metric, err error)

	LookupMetric(metric model.Metric) (id int, err error)

	LabelValues(name string) (values []string, err error)

	// Close the database. No further operations must be attempted.
	Close() error
}

IndexDB is used to map a time-series name to an integer and vice-versa. It can also return a list of ids that match a given label expression.

type Iterator

type Iterator interface {
	Seek(t uint64) bool

	At() (t uint64, v float64)

	Next() bool

	Close()
}

type LatestDB

type LatestDB interface {
	Put(seriesID int, metric model.Metric, timestamp uint64, value float64) error

	Get(seriesID int) (metric model.Metric, timestamp uint64, value float64, err error)

	Iterate(cb LatestDBProcessorFunc) error

	Close() error
}

LatestDB stores the latest value for a metric (identified by an integer). The timestamp for the value is also stored, to support staleness feature.

type LatestDBProcessorFunc

type LatestDBProcessorFunc func(seriesID int, metric model.Metric, timestamp uint64,
	value float64) error

type Reaper

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

func NewReaper

func NewReaper(db DB, config model.GeneralConfig) *Reaper

func (*Reaper) Interval

func (r *Reaper) Interval() time.Duration

func (*Reaper) Retain

func (r *Reaper) Retain() time.Duration

func (*Reaper) Start

func (r *Reaper) Start()

func (*Reaper) Stop

func (r *Reaper) Stop()

type Storer

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

func NewStorer

func NewStorer(db DB, config model.GeneralConfig, outputs []output.Output) *Storer

func (*Storer) Downsample

func (s *Storer) Downsample() time.Duration

func (*Storer) Start

func (s *Storer) Start()

func (*Storer) Stop

func (s *Storer) Stop()

func (*Storer) Store

func (s *Storer) Store(metric model.Metric, samples []model.Sample) error

func (*Storer) TTL

func (s *Storer) TTL() time.Duration

type TSDB

type TSDB interface {
	Put(seriesID int, timestamp uint64, value float64) error

	Query(seriesID int, from, to uint64) (result []model.Sample, err error)

	Iterate(seriesID int) Iterator

	Close() error

	DeleteUntil(timestamp uint64) (count int, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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