Documentation ¶
Index ¶
- type MetaCache
- func (mc *MetaCache) AddContainer(podUID string, containerName string, containerInfo *types.ContainerInfo) error
- func (mc *MetaCache) DeleteContainer(podUID string, containerName string) error
- func (mc *MetaCache) DeletePool(poolName string) error
- func (mc *MetaCache) GCPoolEntries(livingPoolNameSet map[string]struct{}) error
- func (mc *MetaCache) GetContainerInfo(podUID string, containerName string) (*types.ContainerInfo, bool)
- func (mc *MetaCache) GetContainerMetric(podUID string, containerName string, metricName string) (float64, error)
- func (mc *MetaCache) GetPoolInfo(poolName string) (*types.PoolInfo, bool)
- func (mc *MetaCache) RangeAndUpdateContainer(...)
- func (mc *MetaCache) RangeContainer(...)
- func (mc *MetaCache) RemovePod(podUID string) error
- func (mc *MetaCache) SetContainerInfo(podUID string, containerName string, containerInfo *types.ContainerInfo) error
- func (mc *MetaCache) SetPoolInfo(poolName string, poolInfo *types.PoolInfo) error
- type MetaCacheCheckpoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetaCache ¶
type MetaCache struct {
// contains filtered or unexported fields
}
MetaCache stores metadata and info of pod, node, pool, subnuma etc. as a cache, and synchronizes data to sysadvisor state file. It is thread-safe to read and write. Deep copy logic is performed during accessing metacache entries instead of directly return pointer of each struct to avoid mis-overwrite.
func NewMetaCache ¶
func NewMetaCache(conf *config.Configuration, metricsFetcher metric.MetricsFetcher) (*MetaCache, error)
NewMetaCache returns the single instance of MetaCache
func (*MetaCache) AddContainer ¶
func (mc *MetaCache) AddContainer(podUID string, containerName string, containerInfo *types.ContainerInfo) error
AddContainer adds a container keyed by pod uid and container name. For repeatedly added container, only mutable meta data will be updated, i.e. request quantity changed by vpa
func (*MetaCache) DeleteContainer ¶
DeleteContainer deletes a ContainerInfo keyed by pod uid and container name
func (*MetaCache) DeletePool ¶
DeletePool deletes a PoolInfo keyed by pool name
func (*MetaCache) GCPoolEntries ¶
GCPoolEntries deletes GCPoolEntries not existing on node
func (*MetaCache) GetContainerInfo ¶
func (mc *MetaCache) GetContainerInfo(podUID string, containerName string) (*types.ContainerInfo, bool)
GetContainerInfo returns a ContainerInfo copy keyed by pod uid and container name
func (*MetaCache) GetContainerMetric ¶
func (mc *MetaCache) GetContainerMetric(podUID string, containerName string, metricName string) (float64, error)
GetContainerMetric returns the metric value of a container
func (*MetaCache) GetPoolInfo ¶
GetPoolInfo returns a PoolInfo copy by pool name
func (*MetaCache) RangeAndUpdateContainer ¶
func (mc *MetaCache) RangeAndUpdateContainer(f func(podUID string, containerName string, containerInfo *types.ContainerInfo) bool)
RangeAndUpdateContainer applies a function to every podUID, containerName, containerInfo set. Not recommended to use if RangeContainer satisfies the requirement.
func (*MetaCache) RangeContainer ¶
func (mc *MetaCache) RangeContainer(f func(podUID string, containerName string, containerInfo *types.ContainerInfo) bool)
RangeContainer applies a function to every podUID, containerName, containerInfo set. Deep copy logic is applied so that pod and container entries will not be overwritten.
func (*MetaCache) RemovePod ¶
RemovePod deletes a PodInfo keyed by pod uid. Repeatedly remove will be ignored.
func (*MetaCache) SetContainerInfo ¶
func (mc *MetaCache) SetContainerInfo(podUID string, containerName string, containerInfo *types.ContainerInfo) error
SetContainerInfo updates ContainerInfo keyed by pod uid and container name
type MetaCacheCheckpoint ¶
type MetaCacheCheckpoint struct { PodEntries types.PodEntries `json:"pod_entries"` PoolEntries types.PoolEntries `json:"pool_entries"` Checksum checksum.Checksum `json:"checksum"` }
func NewMetaCacheCheckpoint ¶
func NewMetaCacheCheckpoint() *MetaCacheCheckpoint
func (*MetaCacheCheckpoint) MarshalCheckpoint ¶
func (cp *MetaCacheCheckpoint) MarshalCheckpoint() ([]byte, error)
MarshalCheckpoint returns marshalled checkpoint
func (*MetaCacheCheckpoint) UnmarshalCheckpoint ¶
func (cp *MetaCacheCheckpoint) UnmarshalCheckpoint(blob []byte) error
UnmarshalCheckpoint tries to unmarshal passed bytes to checkpoint
func (*MetaCacheCheckpoint) VerifyChecksum ¶
func (cp *MetaCacheCheckpoint) VerifyChecksum() error
VerifyChecksum verifies that current checksum of checkpoint is valid