Documentation ¶
Index ¶
- type AdvisorMetaWriter
- type AdvisorNotifier
- type MetaCache
- type MetaCacheCheckpoint
- type MetaCacheImp
- func (mc *MetaCacheImp) AddContainer(podUID string, containerName string, containerInfo *types.ContainerInfo) error
- func (mc *MetaCacheImp) DeleteContainer(podUID string, containerName string) error
- func (mc *MetaCacheImp) DeletePool(poolName string) error
- func (mc *MetaCacheImp) GCPoolEntries(livingPoolNameSet sets.String) error
- func (mc *MetaCacheImp) GetContainerEntries(podUID string) (types.ContainerEntries, bool)
- func (mc *MetaCacheImp) GetContainerInfo(podUID string, containerName string) (*types.ContainerInfo, bool)
- func (mc *MetaCacheImp) GetContainerMetric(podUID string, containerName string, metricName string) (float64, error)
- func (mc *MetaCacheImp) GetPoolInfo(poolName string) (*types.PoolInfo, bool)
- func (mc *MetaCacheImp) GetPoolSize(poolName string) (int, bool)
- func (mc *MetaCacheImp) GetRegionInfo(regionName string) (*types.RegionInfo, bool)
- func (mc *MetaCacheImp) RangeAndDeleteContainer(f func(containerInfo *types.ContainerInfo) bool) error
- func (mc *MetaCacheImp) RangeAndUpdateContainer(...) error
- func (mc *MetaCacheImp) RangeContainer(...)
- func (mc *MetaCacheImp) RangeRegionInfo(f func(regionName string, regionInfo *types.RegionInfo) bool)
- func (mc *MetaCacheImp) RemovePod(podUID string) error
- func (mc *MetaCacheImp) SetContainerInfo(podUID string, containerName string, containerInfo *types.ContainerInfo) error
- func (mc *MetaCacheImp) SetPoolInfo(poolName string, poolInfo *types.PoolInfo) error
- func (mc *MetaCacheImp) SetRegionEntries(entries types.RegionEntries) error
- func (mc *MetaCacheImp) SetRegionInfo(regionName string, regionInfo *types.RegionInfo) error
- type MetaReader
- type RawMetaWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdvisorMetaWriter ¶ added in v0.2.0
type AdvisorMetaWriter interface { // SetRegionEntries overwrites the whole region entries SetRegionEntries(entries types.RegionEntries) error // SetRegionInfo stores a RegionInfo by region name SetRegionInfo(regionName string, regionInfo *types.RegionInfo) error }
AdvisorMetaWriter provides a standard interface to modify advised metadata (generated by sysadvisor)
type AdvisorNotifier ¶ added in v0.3.0
type AdvisorNotifier struct{}
type MetaCache ¶
type MetaCache interface { MetaReader RawMetaWriter AdvisorMetaWriter }
type MetaCacheCheckpoint ¶
type MetaCacheCheckpoint struct { PodEntries types.PodEntries `json:"pod_entries"` PoolEntries types.PoolEntries `json:"pool_entries"` RegionEntries types.RegionEntries `json:"region_entries"` Checksum checksum.Checksum `json:"checksum"` }
func NewMetaCacheCheckpoint ¶
func NewMetaCacheCheckpoint() *MetaCacheCheckpoint
func (*MetaCacheCheckpoint) MarshalCheckpoint ¶
func (cp *MetaCacheCheckpoint) MarshalCheckpoint() ([]byte, error)
MarshalCheckpoint returns marshaled 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
type MetaCacheImp ¶ added in v0.2.0
type MetaCacheImp struct {
// contains filtered or unexported fields
}
MetaCacheImp 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 NewMetaCacheImp ¶ added in v0.2.0
func NewMetaCacheImp(conf *config.Configuration, metricsFetcher metric.MetricsFetcher) (*MetaCacheImp, error)
NewMetaCacheImp returns the single instance of MetaCacheImp
func (*MetaCacheImp) AddContainer ¶ added in v0.2.0
func (mc *MetaCacheImp) AddContainer(podUID string, containerName string, containerInfo *types.ContainerInfo) error
func (*MetaCacheImp) DeleteContainer ¶ added in v0.2.0
func (mc *MetaCacheImp) DeleteContainer(podUID string, containerName string) error
func (*MetaCacheImp) DeletePool ¶ added in v0.2.0
func (mc *MetaCacheImp) DeletePool(poolName string) error
func (*MetaCacheImp) GCPoolEntries ¶ added in v0.2.0
func (mc *MetaCacheImp) GCPoolEntries(livingPoolNameSet sets.String) error
func (*MetaCacheImp) GetContainerEntries ¶ added in v0.2.0
func (mc *MetaCacheImp) GetContainerEntries(podUID string) (types.ContainerEntries, bool)
func (*MetaCacheImp) GetContainerInfo ¶ added in v0.2.0
func (mc *MetaCacheImp) GetContainerInfo(podUID string, containerName string) (*types.ContainerInfo, bool)
func (*MetaCacheImp) GetContainerMetric ¶ added in v0.2.0
func (*MetaCacheImp) GetPoolInfo ¶ added in v0.2.0
func (mc *MetaCacheImp) GetPoolInfo(poolName string) (*types.PoolInfo, bool)
func (*MetaCacheImp) GetPoolSize ¶ added in v0.2.0
func (mc *MetaCacheImp) GetPoolSize(poolName string) (int, bool)
func (*MetaCacheImp) GetRegionInfo ¶ added in v0.2.0
func (mc *MetaCacheImp) GetRegionInfo(regionName string) (*types.RegionInfo, bool)
func (*MetaCacheImp) RangeAndDeleteContainer ¶ added in v0.2.0
func (mc *MetaCacheImp) RangeAndDeleteContainer(f func(containerInfo *types.ContainerInfo) bool) error
func (*MetaCacheImp) RangeAndUpdateContainer ¶ added in v0.2.0
func (mc *MetaCacheImp) RangeAndUpdateContainer(f func(podUID string, containerName string, containerInfo *types.ContainerInfo) bool) error
func (*MetaCacheImp) RangeContainer ¶ added in v0.2.0
func (mc *MetaCacheImp) RangeContainer(f func(podUID string, containerName string, containerInfo *types.ContainerInfo) bool)
RangeContainer should deepcopy so that pod and container entries will not be overwritten.
func (*MetaCacheImp) RangeRegionInfo ¶ added in v0.2.0
func (mc *MetaCacheImp) RangeRegionInfo(f func(regionName string, regionInfo *types.RegionInfo) bool)
func (*MetaCacheImp) RemovePod ¶ added in v0.2.0
func (mc *MetaCacheImp) RemovePod(podUID string) error
func (*MetaCacheImp) SetContainerInfo ¶ added in v0.2.0
func (mc *MetaCacheImp) SetContainerInfo(podUID string, containerName string, containerInfo *types.ContainerInfo) error
func (*MetaCacheImp) SetPoolInfo ¶ added in v0.2.0
func (mc *MetaCacheImp) SetPoolInfo(poolName string, poolInfo *types.PoolInfo) error
func (*MetaCacheImp) SetRegionEntries ¶ added in v0.2.0
func (mc *MetaCacheImp) SetRegionEntries(entries types.RegionEntries) error
func (*MetaCacheImp) SetRegionInfo ¶ added in v0.2.0
func (mc *MetaCacheImp) SetRegionInfo(regionName string, regionInfo *types.RegionInfo) error
type MetaReader ¶ added in v0.2.0
type MetaReader interface { // GetContainerEntries returns a ContainerEntry copy keyed by pod uid GetContainerEntries(podUID string) (types.ContainerEntries, bool) // GetContainerInfo returns a ContainerInfo copy keyed by pod uid and container name GetContainerInfo(podUID string, containerName string) (*types.ContainerInfo, bool) // GetContainerMetric returns the metric value of a container GetContainerMetric(podUID string, containerName string, metricName string) (float64, error) // RangeContainer applies a function to every podUID, containerName, containerInfo set RangeContainer(f func(podUID string, containerName string, containerInfo *types.ContainerInfo) bool) // GetPoolInfo returns a PoolInfo copy by pool name GetPoolInfo(poolName string) (*types.PoolInfo, bool) // GetPoolSize returns the size of pool as integer GetPoolSize(poolName string) (int, bool) // GetRegionInfo returns a RegionInfo copy by region name GetRegionInfo(regionName string) (*types.RegionInfo, bool) // RangeRegionInfo applies a function to every regionName, regionInfo set. // If f returns false, range stops the iteration. RangeRegionInfo(f func(regionName string, regionInfo *types.RegionInfo) bool) }
MetaReader provides a standard interface to refer to metadata type
type RawMetaWriter ¶ added in v0.2.0
type RawMetaWriter interface { // AddContainer adds a container keyed by pod uid and container name. For repeatedly added // container, only mutable metadata will be updated, i.e. request quantity changed by vpa AddContainer(podUID string, containerName string, containerInfo *types.ContainerInfo) error // SetContainerInfo updates ContainerInfo keyed by pod uid and container name SetContainerInfo(podUID string, containerName string, containerInfo *types.ContainerInfo) error // RangeAndUpdateContainer applies a function to every podUID, containerName, containerInfo set. // Not recommended using if RangeContainer satisfies the requirement. // If f returns false, range stops the iteration. RangeAndUpdateContainer(f func(podUID string, containerName string, containerInfo *types.ContainerInfo) bool) error // DeleteContainer deletes a ContainerInfo keyed by pod uid and container name DeleteContainer(podUID string, containerName string) error // RangeAndDeleteContainer applies a function to every podUID, containerName, containerInfo set. // If f returns true, the containerInfo will be deleted. RangeAndDeleteContainer(f func(containerInfo *types.ContainerInfo) bool) error // RemovePod deletes a PodInfo keyed by pod uid. Repeatedly remove will be ignored. RemovePod(podUID string) error // SetPoolInfo stores a PoolInfo by pool name SetPoolInfo(poolName string, poolInfo *types.PoolInfo) error // DeletePool deletes a PoolInfo keyed by pool name DeletePool(poolName string) error // GCPoolEntries deletes GCPoolEntries not existing on node GCPoolEntries(livingPoolNameSet sets.String) error }
RawMetaWriter provides a standard interface to modify raw metadata (generated by other agents) in local cache