cache

package
v0.0.0-...-59d7cbf Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ControllerCache = newControllerCache()
View Source
var Deployments = newDeploymentsCache()
View Source
var IdentityCluster = newIdentityCluster()
View Source
var IdentityDependency = newIdentityDependency()
View Source
var RemoteCluster = newRemoteCluster()
View Source
var Rollouts = newRolloutsCache()
View Source
var Services = newServicesCache()
View Source
var TrafficConfigCache = newTrafficConfigCache()

Functions

func ResetAllCaches

func ResetAllCaches()

This is used for testing purposes only. ResetAllCache resets all caches.

Types

type BaseCache

type BaseCache interface {
	// This is used for testing purposes only.
	// Reset resets the cache.
	Reset()
}

type ControllerCacheInterface

type ControllerCacheInterface interface {
	BaseCache
	Register(name string, ctlrContext ControllerContext)
	DeRegister(name string)
	List() map[string]ControllerContext
	GetStopCh(name string) ControllerContext
	Range(f func(key any, value interface{}) bool)
}

type ControllerContext

type ControllerContext struct {
	WorkerCtx []context.Context
	StopCh    chan struct{}
}

type DeploymentCache

type DeploymentCache interface {
	BaseCache
	GetByClusterIdentityEnv(clusterID, identity, env string) *k8sAppsV1.Deployment
	GetByClusterIdentity(clusterID, identity string) *DeploymentEntry
	GetByIdentity(identity string) []*DeploymentItem
	GetNoOfDeployments() int
	Add(clusterID string, deployment *k8sAppsV1.Deployment)
	Delete(clusterID string, deployment *k8sAppsV1.Deployment)
}

type DeploymentEntry

type DeploymentEntry struct {
	Identity    string                     `json:"identity"`
	Deployments map[string]*DeploymentItem // map[env]*DeploymentItem
}

type DeploymentItem

type DeploymentItem struct {
	Deployment *k8sAppsV1.Deployment `json:"deployment"`
	ClusterID  string                `json:"clusterId"`
}

type IdentityClusterCache

type IdentityClusterCache interface {
	BaseCache
	AddClusterToIdentity(identity string, clusterID string)
	DeleteClusterFromIdentity(identity string, clusterID string)
	GetClustersForIdentity(identity string) []string
	ListIdentities() []string
	IsClusterPresentInIdentity(identity string, clusterID string) bool
}

type IdentityDependencyCache

type IdentityDependencyCache interface {
	BaseCache
	// AddDependencyToIdentity adds a dependency to the given identity
	AddDependencyToIdentity(identity string, dependency string)
	// AddDependentToIdentity adds a dependent to the given identity
	AddDependentToIdentity(identity string, dependent string)
	DeleteDependencyFromIdentity(identity string, dependency string)
	DeleteDependentFromIdentity(identity string, dependent string)
	// GetDependenciesForIdentity returns a list of identities that the given identity depends on
	GetDependenciesForIdentity(identity string) []string
	// GetDependentsForIdentity returns a list of identities that are dependent on the given identity
	GetDependentsForIdentity(identity string) []string
	IsDependentForIdentity(identity string, dependency string) bool
	GetTotalDependencies() int
	RangedDependencies(func(identity string, dependencies []string) bool)

	// Used for unit tests, not advised to use this in production code
	Reset()
}

type K8sServiceEntry

type K8sServiceEntry struct {
	Namespace string                     `json:"namespace"`
	Services  map[string]*K8sServiceItem // map[env]*K8sServiceItem
}

func (*K8sServiceEntry) Copy

func (kse *K8sServiceEntry) Copy() *K8sServiceEntry

type K8sServiceItem

type K8sServiceItem struct {
	Service   *corev1.Service `json:"service"`
	ClusterID string          `json:"clusterId"`
}

type RemoteClusterCache

type RemoteClusterCache interface {
	BaseCache
	AddCluster(remoteCluster remotecluster.RemoteCluster)
	DeleteCluster(clusterID string)
	// GetCluster returns the remote cluster and a boolean indicating if the cluster exists
	GetCluster(clusterID string) (remotecluster.RemoteCluster, bool)
	ListClusters() []remotecluster.RemoteCluster
	UpdateCluster(clusterID string, remoteCluster remotecluster.RemoteCluster) (remotecluster.RemoteCluster, bool)
}

type RolloutCache

type RolloutCache interface {
	BaseCache
	GetByClusterIdentityEnv(clusterID, identity, env string) *argov1alpha1.Rollout
	GetByClusterIdentity(clusterID, identity string) *RolloutEntry
	GetByIdentity(identity string) []*RolloutItem
	GetNoOfRollouts() int
	Add(clusterID string, rollout *argov1alpha1.Rollout)
	Delete(clusterID string, rollout *argov1alpha1.Rollout)
}

type RolloutEntry

type RolloutEntry struct {
	Identity string                  `json:"identity"`
	Rollouts map[string]*RolloutItem // map[env]*RolloutItem
}

type RolloutItem

type RolloutItem struct {
	Rollout   *argov1alpha1.Rollout `json:"rollout"`
	ClusterID string                `json:"clusterId"`
}

type ServicesCache

type ServicesCache interface {
	BaseCache
	GetByClusterNamespace(clusterID, identity string) *K8sServiceEntry
	GetByNamespace(identity string) []*K8sServiceItem
	Add(clusterID string, service *corev1.Service)
	Delete(clusterID string, service *corev1.Service)
}

type TrafficConfigCacheInterface

type TrafficConfigCacheInterface interface {
	BaseCache
	GetTrafficConfigEntry(identity string) *TrafficConfigEntry
	Get(identity string, env string) *admiralv1.TrafficConfig
	AddTrafficConfigToCache(trafficConfig *admiralv1.TrafficConfig)
	DeleteTrafficConfigFromCache(trafficConfig *admiralv1.TrafficConfig)
	GetTotalTrafficConfigs() int
}

type TrafficConfigEntry

type TrafficConfigEntry struct {
	sync.Mutex
	Identity               string                                       `json:"identity"`
	EnvTrafficConfig       map[string]*admiralv1.TrafficConfig          // map[env]*v1.TrafficConfig
	EnvServiceRoutesConfig map[string]*trafficconfig.ServiceRouteConfig // Map of env routes
}

func (*TrafficConfigEntry) Copy

Jump to

Keyboard shortcuts

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