cache

package
v0.0.0-...-fe9cd46 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCopy

func DeepCopy(pairs map[types.UID]*PodNodePair) map[types.UID]*PodNodePair

DeepCopy copies the pod node pair

Types

type Cache

type Cache interface {
	Get(string) Object
	Set(string, Object)
	Delete(string)
}

Cache provides func Get, Set, Delete to operation cache

type Object

type Object interface {
}

Object is A abstract interface

type PGStatusCache

type PGStatusCache struct {
	sync.RWMutex
	// NodeDiskStatus maps podGroupName to its DiskStatus
	PGStatusMap map[string]*PodGroupMatchStatus
}

PGStatusCache provide safe function Get, Set, Delete.

func NewPGStatusCache

func NewPGStatusCache() *PGStatusCache

NewPGStatusCache initializers pod status cache

func (*PGStatusCache) Delete

func (psc *PGStatusCache) Delete(podGroupName string)

Delete Node status from cache

func (*PGStatusCache) Get

func (psc *PGStatusCache) Get(podGroupName string) Object

Get cache according to podGroupName

func (*PGStatusCache) Set

func (psc *PGStatusCache) Set(podGroupName string, pg Object)

Set node status to the cache

type PodGroupMatchStatus

type PodGroupMatchStatus struct {
	// used to lock map
	CountLock sync.RWMutex
	PodGroup  *v1.PodGroup
	// store permitted pod node map with ttl
	MatchedPodNodes *gochache.Cache
	// store permitted pod name and uuid map with ttl
	PodNameUIDs *gochache.Cache
	// failed pods
	Failed map[string]string
	// succeed pods
	Succeed map[string]string
	Pod     *v12.Pod
	// Scheduled marks if has scheduled
	Scheduled bool
}

PodGroupMatchStatus helps record pod group status

type PodNodePair

type PodNodePair struct {
	PodName string
	Node    string
}

PodNodePair is a pair contains pod name and node

Jump to

Keyboard shortcuts

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