memory

package
v0.0.0-...-02a3e46 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

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.

func (*StatsBuffer) Size

func (self *StatsBuffer) Size() int

Jump to

Keyboard shortcuts

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