Documentation ¶
Index ¶
- type InMemoryStorage
- type StatsBuffer
- func (self *StatsBuffer) Add(item *info.ContainerStats)
- func (self *StatsBuffer) FirstN(n int) []*info.ContainerStats
- func (self *StatsBuffer) Get(index int) *info.ContainerStats
- func (self *StatsBuffer) InTimeRange(start, end time.Time, maxResults int) []*info.ContainerStats
- func (self *StatsBuffer) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryStorage ¶
type InMemoryStorage struct {
// contains filtered or unexported fields
}
func New ¶
func New( maxNumStats int, backend storage.StorageDriver, ) *InMemoryStorage
func (*InMemoryStorage) AddStats ¶
func (self *InMemoryStorage) AddStats(ref info.ContainerReference, stats *info.ContainerStats) error
func (*InMemoryStorage) Close ¶
func (self *InMemoryStorage) Close() error
func (*InMemoryStorage) RecentStats ¶
func (self *InMemoryStorage) RecentStats(name string, start, end time.Time, maxStats int) ([]*info.ContainerStats, error)
type StatsBuffer ¶
type StatsBuffer struct {
// contains filtered or unexported fields
}
A circular buffer for ContainerStats.
func NewStatsBuffer ¶
func NewStatsBuffer(size int) *StatsBuffer
Returns a new thread-compatible StatsBuffer.
func (*StatsBuffer) Add ¶
func (self *StatsBuffer) Add(item *info.ContainerStats)
Adds an element to the start of the buffer (removing one from the end if necessary).
func (*StatsBuffer) FirstN ¶
func (self *StatsBuffer) FirstN(n int) []*info.ContainerStats
TODO(vmarmol): Remove this function as it will no longer be neededt. Returns the first N elements in the buffer. If N > size of buffer, size of buffer elements are returned. Returns the elements in ascending timestamp order.
func (*StatsBuffer) Get ¶
func (self *StatsBuffer) Get(index int) *info.ContainerStats
Gets the element at the specified index. Note that elements are stored in LIFO order.
func (*StatsBuffer) InTimeRange ¶
func (self *StatsBuffer) InTimeRange(start, end time.Time, maxResults int) []*info.ContainerStats
Returns up to maxResult elements in the specified time period (inclusive). Results are from first to last. maxResults of -1 means no limit. When first and last are specified, maxResults is ignored.
func (*StatsBuffer) Size ¶
func (self *StatsBuffer) Size() int