Documentation
¶
Overview ¶
Package cache implements a cache for time series data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
StorePods([]source_api.Pod) error
StoreContainers([]source_api.Container) error
// TODO: Handle events.
// GetPods returns a list of pod elements in the cache between 'start' and 'end'.
// If 'start' is zero, it returns all the elements up until 'end'.
// If 'end' is zero, it returns all the elements from 'start'.
// If both 'start' and 'end' are zero, it returns all the elements in the cache.
GetPods(start, end time.Time) []*PodElement
// GetNodes returns a list of pod elements in the cache between 'start' and 'end'.
// If 'start' is zero, it returns all the elements up until 'end'.
// If 'end' is zero, it returns all the elements from 'start'.
// If both 'start' and 'end' are zero, it returns all the elements in the cache.
GetNodes(start, end time.Time) []*ContainerElement
// GetFreeContainers returns a list of pod elements in the cache between 'start' and 'end'.
// If 'start' is zero, it returns all the elements up until 'end'.
// If 'end' is zero, it returns all the elements from 'start'.
// If both 'start' and 'end' are zero, it returns all the elements in the cache.
GetFreeContainers(start, end time.Time) []*ContainerElement
}
type ContainerElement ¶
type ContainerElement struct {
Metadata
Metrics []*ContainerMetricElement
}
type ContainerMetricElement ¶
type ContainerMetricElement struct {
Spec *cadvisor_api.ContainerSpec
Stats *cadvisor_api.ContainerStats
}
type PodElement ¶
type PodElement struct {
Metadata
// map of container name to container element.
Containers []*ContainerElement
}
type TimeStore ¶
type TimeStore interface {
// Put stores 'data' with 'timestamp'. Returns error upon failure.
// Ignores zero timestamps.
Put(timestamp time.Time, data interface{}) error
// Get returns a slice of elements that were previously stored with timestamps
// between 'start' and 'end'. 'start' is expected to be before 'end'.
// If 'start' is zero, it returns all the elements up until 'end'.
// If 'end' is zero, it returns all the elements from 'start'.
// If both 'start' and 'end' are zero, it returns all the elements in the cache.
Get(start, end time.Time) []interface{}
// Delete removes all elements that were previously stored with timestamps
// between 'start' and 'end'.
Delete(start, end time.Time) error
}
TimeStore represents a timeseries storage. Implementations are expected to be thread safe.
func NewTimeStore ¶
func NewTimeStore() TimeStore
Click to show internal directories.
Click to hide internal directories.