storage

package
v0.8.10-1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaVersion = 1
)

Variables

View Source
var (
	ErrInvalidFromTo     = errors.New("invalid 'from' & 'to'")
	ErrInvalidAggregator = errors.New("invalid aggregator")
	ErrInvalidMetricType = errors.New("invalid metric type")
	ErrUnknownMetricID   = errors.New("unknown metric ID")
)

Functions

This section is empty.

Types

type Application

type Application interface {
	Cfg() *config.Config
}

type CachedMetric

type CachedMetric struct {
	ID          int
	Name        string
	Flag        string
	Format      string
	Description string
	Class       string
}

func (*CachedMetric) FormatValue

func (cm *CachedMetric) FormatValue(value any) any

type MetricSample

type MetricSample struct {
	Name        string
	Flag        string
	Format      string
	Description string
	Value       any
}

type MockApplication

type MockApplication struct {
	mock.Mock
}

MockApplication is an autogenerated mock type for the Application type

func NewMockApplication

func NewMockApplication(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockApplication

NewMockApplication creates a new instance of MockApplication. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockApplication) Cfg

func (_m *MockApplication) Cfg() *config.Config

Cfg provides a mock function with no fields

type Storage

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

func NewStorage

func NewStorage(app Application) *Storage

func (*Storage) Earliest

func (stg *Storage) Earliest() time.Time

func (*Storage) GetMetric

func (stg *Storage) GetMetric(
	id int, from, to time.Time, step int,
	aggregator string) (map[string]any, error)

func (*Storage) GetMetrics

func (stg *Storage) GetMetrics(
	from, to time.Time, step int, page, pageSize int) (map[string]any, error)

func (*Storage) Hostname

func (stg *Storage) Hostname() string

func (*Storage) Latest

func (stg *Storage) Latest() time.Time

func (*Storage) PushMetricSamples

func (stg *Storage) PushMetricSamples(timestamp time.Time, samples []*MetricSample) error

func (*Storage) Shutdown

func (stg *Storage) Shutdown() error

Jump to

Keyboard shortcuts

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