cache

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const NodeContainerName = "machine"

NodeContainerName is the container name assigned to node level metrics.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	EventsCache
	StorePods([]source_api.Pod) error
	StoreContainers([]source_api.Container) error
	// TODO: Handle events.
	// GetPods returns a list of pod elements holding the metrics between 'start' and 'end' in the cache.
	// 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 container elements holding the node level metrics between 'start' and 'end' in the cache.
	// 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 container elements holding the metrics between 'start' and 'end' in the cache.
	// 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
	// GetEvents returns a list of events in the cache between 'start' and 'end.
	// If 'start' is zero, it returns all the events up until 'end'.
	// If 'end' is zero, it returns all the events from 'start'.
	// If both 'start' and 'end' are zero, it returns all the events in the cache.
	GetEvents(start, end time.Time) []*Event

	// Adds eviction listener to the list of listeners. The listeners
	// will be triggered when the correspoinding eviction events occur.
	AddCacheListener(listener CacheListener)
}

func NewCache

func NewCache(bufferDuration, gcDuration time.Duration) Cache

type CacheListener added in v0.18.0

type CacheListener struct {
	NodeEvicted          func(hostName string)
	NamespaceEvicted     func(namespace string)
	PodEvicted           func(namespace string, podName string)
	PodContainerEvicted  func(namespace string, podName string, containerName string)
	FreeContainerEvicted func(hostName string, containerName string)
}

type ContainerElement

type ContainerElement struct {
	Metadata
	// Container base image.
	Image string
	// Data points are in reverse chronological order (most recent to oldest).
	Metrics []*ContainerMetricElement
}

type ContainerMetricElement

type ContainerMetricElement struct {
	Spec  *source_api.ContainerSpec
	Stats *source_api.ContainerStats
}

type Event added in v0.18.0

type Event struct {
	Metadata
	// Detailed description of the event.
	Message string
	// The source component that generated the event.
	Source string
	// Store a public API version instead of internal version.
	Raw kube_api.Event
}

type EventsCache added in v0.18.0

type EventsCache interface {
	StoreEvents([]*Event) error
}

type Metadata

type Metadata struct {
	Name         string
	Namespace    string
	NamespaceUID string
	UID          string
	Hostname     string
	Labels       map[string]string
	ExternalID   string
	LastUpdate   time.Time
}

type PodElement

type PodElement struct {
	Metadata
	// map of container name to container element.
	Containers []*ContainerElement
}

Jump to

Keyboard shortcuts

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