Documentation ¶
Index ¶
- Constants
- func TestNodeMetricCustomInfo(nodeNames []string, numbers []int64) metrics.NodeMetricsInfo
- type AutoUpdatingCache
- func (n *AutoUpdatingCache) DeleteMetric(metricName string) error
- func (n *AutoUpdatingCache) DeletePolicy(namespace string, policyName string) error
- func (n *AutoUpdatingCache) PeriodicUpdate(period time.Ticker, client metrics.Client, initialData map[string]interface{})
- func (n *AutoUpdatingCache) ReadMetric(metricName string) (metrics.NodeMetricsInfo, error)
- func (n *AutoUpdatingCache) ReadPolicy(namespace string, policyName string) (telemetrypolicy.TASPolicy, error)
- func (n *AutoUpdatingCache) WriteMetric(metricName string, data metrics.NodeMetricsInfo) error
- func (n *AutoUpdatingCache) WritePolicy(namespace string, policyName string, policy telemetrypolicy.TASPolicy) error
- type Interface
- type MockCache
- func (n MockCache) DeleteMetric(metricName string) error
- func (n MockCache) DeletePolicy(namespace string, policyName string) error
- func (n MockCache) ReadMetric(string) (metrics.NodeMetricsInfo, error)
- func (n MockCache) ReadPolicy(string, string) (telemetrypolicy.TASPolicy, error)
- func (n MockCache) WriteMetric(metricName string, _ metrics.NodeMetricsInfo) error
- func (n MockCache) WritePolicy(namespace string, _ string, _ telemetrypolicy.TASPolicy) error
- type Reader
- type ReaderWriter
- type SelfUpdating
- type Writer
Constants ¶
const ( READ requestType = iota WRITE DELETE )
const for requestType value.
Variables ¶
This section is empty.
Functions ¶
func TestNodeMetricCustomInfo ¶
func TestNodeMetricCustomInfo(nodeNames []string, numbers []int64) metrics.NodeMetricsInfo
TestNodeMetricCustomInfo returns the node metrics information.
Types ¶
type AutoUpdatingCache ¶
type AutoUpdatingCache struct {
// contains filtered or unexported fields
}
AutoUpdatingCache holds a map of metrics of interest with their associated NodeMetricsInfo object.
func MockSelfUpdatingCache ¶
func MockSelfUpdatingCache() *AutoUpdatingCache
MockSelfUpdatingCache returns auto updating cache.
func NewAutoUpdatingCache ¶
func NewAutoUpdatingCache() *AutoUpdatingCache
NewAutoUpdatingCache returns an empty metrics cache.
func (*AutoUpdatingCache) DeleteMetric ¶
func (n *AutoUpdatingCache) DeleteMetric(metricName string) error
DeleteMetric keeps track of the number of policies currently using this metric. It is removed from the cache, if there are no policies associated with this metric.
func (*AutoUpdatingCache) DeletePolicy ¶
func (n *AutoUpdatingCache) DeletePolicy(namespace string, policyName string) error
DeletePolicy removes the policy removes the policy object at the given namespace/name string from the cache.
func (*AutoUpdatingCache) PeriodicUpdate ¶
func (n *AutoUpdatingCache) PeriodicUpdate(period time.Ticker, client metrics.Client, initialData map[string]interface{})
PeriodicUpdate updates all the metrics in the Cache periodically based on a ticker passed to it.
func (*AutoUpdatingCache) ReadMetric ¶
func (n *AutoUpdatingCache) ReadMetric(metricName string) (metrics.NodeMetricsInfo, error)
ReadMetric returns the NodeMetricsInfo object for the passed named metric. If no metric of that name is found it returns an error.
func (*AutoUpdatingCache) ReadPolicy ¶
func (n *AutoUpdatingCache) ReadPolicy(namespace string, policyName string) (telemetrypolicy.TASPolicy, error)
ReadPolicy returns the policy object under the passed name and namespace from the cache.
func (*AutoUpdatingCache) WriteMetric ¶
func (n *AutoUpdatingCache) WriteMetric(metricName string, data metrics.NodeMetricsInfo) error
WriteMetric first checks if there's any data with the request and then sends the request to the cache. It also increments a counter showing how many strategies are using the metric - protecting it from deletion until there are no more associated strategies.
func (*AutoUpdatingCache) WritePolicy ¶
func (n *AutoUpdatingCache) WritePolicy(namespace string, policyName string, policy telemetrypolicy.TASPolicy) error
WritePolicy sends the passed object to be stored in the cache under the namespace/name.
type Interface ¶
type Interface interface {
// contains filtered or unexported methods
}
Interface contains the baseline behaviour for a cache.
type MockCache ¶ added in v0.3.0
type MockCache struct {
MockCache interface{}
}
MockCache is used in the tests for the core and other packages.
func (MockCache) DeleteMetric ¶ added in v0.3.0
DeleteMetric is a method implemented for Mock cache.
func (MockCache) DeletePolicy ¶ added in v0.3.0
DeletePolicy is a method implemented for Mock cache.
func (MockCache) ReadMetric ¶ added in v0.3.0
func (n MockCache) ReadMetric(string) (metrics.NodeMetricsInfo, error)
ReadMetric is a method implemented for Mock cache.
func (MockCache) ReadPolicy ¶ added in v0.3.0
ReadPolicy is a method implemented for Mock cache.
func (MockCache) WriteMetric ¶ added in v0.3.0
func (n MockCache) WriteMetric(metricName string, _ metrics.NodeMetricsInfo) error
WriteMetric is a method implemented for Mock cache.
func (MockCache) WritePolicy ¶ added in v0.3.0
WritePolicy is a method implemented for Mock cache.
type Reader ¶
type Reader interface { ReadMetric(string) (metrics.NodeMetricsInfo, error) ReadPolicy(string, string) (telemetrypolicy.TASPolicy, error) }
Reader is the functionality to read metrics and policies from the cache.
type ReaderWriter ¶
ReaderWriter holds the functionality to both read and write metrics and policies.
func MockEmptySelfUpdatingCache ¶
func MockEmptySelfUpdatingCache() ReaderWriter
MockEmptySelfUpdatingCache returns auto updating cache.
type SelfUpdating ¶
SelfUpdating describes functionality to periodically update all metrics in the metric cache.
type Writer ¶
type Writer interface { WriteMetric(string, metrics.NodeMetricsInfo) error WritePolicy(string, string, telemetrypolicy.TASPolicy) error DeleteMetric(string) error DeletePolicy(string, string) error }
Writer is the functionality to edit metrics (write and delete) and Policies in the cache.