cachemanager

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PUT operator = "put"
	DEL operator = "del"
)
View Source
const (
	CompressThresh = 20
)

Variables

View Source
var (
	ErrInMemoryCacheMiss = errors.New("in-memory cache miss")
	ErrNotNodeOrLease    = errors.New("resource is not node or lease")
)
View Source
var (
	AOFPrefix = "/var/lib/" + projectinfo.GetHubName() + "/autonomy"
)

Functions

func NewErrorKeys added in v1.5.0

func NewErrorKeys() *errorKeys

Types

type CacheAgent added in v1.2.0

type CacheAgent struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewCacheAgents added in v1.2.0

func NewCacheAgents(informerFactory informers.SharedInformerFactory, store StorageWrapper) *CacheAgent

func (*CacheAgent) HasAny added in v1.2.0

func (ca *CacheAgent) HasAny(items ...string) bool

type CacheManager

type CacheManager interface {
	CacheResponse(req *http.Request, prc io.ReadCloser, stopCh <-chan struct{}) error
	QueryCache(req *http.Request) (runtime.Object, error)
	CanCacheFor(req *http.Request) bool
	DeleteKindFor(gvr schema.GroupVersionResource) error
	QueryCacheResult() CacheResult
}

CacheManager is an adaptor to cache runtime object data into backend storage

func NewCacheManager

func NewCacheManager(
	storagewrapper StorageWrapper,
	serializerMgr *serializer.SerializerManager,
	restMapperMgr *hubmeta.RESTMapperManager,
	sharedFactory informers.SharedInformerFactory,
) CacheManager

NewCacheManager creates a new CacheManager

type CacheResult added in v1.5.0

type CacheResult struct {
	Length int
	Msg    string
}

type StorageWrapper

type StorageWrapper interface {
	Name() string
	Create(key storage.Key, obj runtime.Object) error
	Delete(key storage.Key) error
	Get(key storage.Key) (runtime.Object, error)
	List(key storage.Key) ([]runtime.Object, error)
	Update(key storage.Key, obj runtime.Object, rv uint64) (runtime.Object, error)
	KeyFunc(info storage.KeyBuildInfo) (storage.Key, error)
	ListResourceKeysOfComponent(component string, gvr schema.GroupVersionResource) ([]storage.Key, error)
	ReplaceComponentList(component string, gvr schema.GroupVersionResource, namespace string, contents map[storage.Key]runtime.Object) error
	DeleteComponentResources(component string) error
	SaveClusterInfo(key storage.Key, content []byte) error
	GetClusterInfo(key storage.Key) ([]byte, error)
	GetStorage() storage.Store
	GetCacheResult() (int, string)
}

StorageWrapper is wrapper for storage.Store interface in order to handle serialize runtime object

func NewStorageWrapper

func NewStorageWrapper(storage storage.Store) StorageWrapper

NewStorageWrapper create a StorageWrapper object

Jump to

Keyboard shortcuts

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