store

package
v0.0.0-...-678bb0e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package store contains code for storing and retreiving metrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNilStore

func IsNilStore(s Store) bool

IsNilStore returns true if given Store is in fact nil-store.

Types

type Fake

type Fake struct {
	Cells []types.Cell
	DT    types.Target
}

Fake is a fake Store.

func (*Fake) DefaultTarget

func (s *Fake) DefaultTarget() types.Target

DefaultTarget returns DT.

func (*Fake) Get

func (s *Fake) Get(context.Context, types.Metric, time.Time, []interface{}) (interface{}, error)

Get does nothing.

func (*Fake) GetAll

func (s *Fake) GetAll(context.Context) []types.Cell

GetAll returns the pre-set list of cells.

func (*Fake) Incr

func (s *Fake) Incr(context.Context, types.Metric, time.Time, []interface{}, interface{}) error

Incr does nothing.

func (*Fake) Register

func (s *Fake) Register(types.Metric)

Register does nothing.

func (*Fake) Reset

func (s *Fake) Reset(context.Context, types.Metric)

Reset does nothing.

func (*Fake) ResetForUnittest

func (s *Fake) ResetForUnittest()

ResetForUnittest does nothing.

func (*Fake) Set

func (s *Fake) Set(context.Context, types.Metric, time.Time, []interface{}, interface{}) error

Set does nothing.

func (*Fake) SetDefaultTarget

func (s *Fake) SetDefaultTarget(types.Target)

SetDefaultTarget does nothing.

func (*Fake) Unregister

func (s *Fake) Unregister(types.Metric)

Unregister does nothing.

type Store

type Store interface {
	Register(m types.Metric)
	Unregister(m types.Metric)

	DefaultTarget() types.Target
	SetDefaultTarget(t types.Target)

	Get(c context.Context, m types.Metric, resetTime time.Time, fieldVals []interface{}) (value interface{}, err error)
	Set(c context.Context, m types.Metric, resetTime time.Time, fieldVals []interface{}, value interface{}) error
	Incr(c context.Context, m types.Metric, resetTime time.Time, fieldVals []interface{}, delta interface{}) error

	GetAll(c context.Context) []types.Cell

	Reset(c context.Context, m types.Metric)
}

A Store is responsible for handling all metric data.

func NewInMemory

func NewInMemory(defaultTarget types.Target) Store

NewInMemory creates a new metric store that holds metric data in this process' memory.

func NewNilStore

func NewNilStore() Store

NewNilStore creates a metric store that completely ignores all metrics.

It's setters are noop, and getters always return errors.

Directories

Path Synopsis
Package storetest is imported exclusively by tests for Store implementations.
Package storetest is imported exclusively by tests for Store implementations.

Jump to

Keyboard shortcuts

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