fscache

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOUCH fscRequestType = iota
	LISTOLD
	LOG
	LISTOLDPOOL
)

FunctionServiceCache Request Types

Variables

This section is empty.

Functions

func GetAttributesForFuncSvc added in v1.15.0

func GetAttributesForFuncSvc(fsvc *FuncSvc) []attribute.KeyValue

func IsNameExistError

func IsNameExistError(err error) bool

IsNameExistError checks if err is ErrorNameExists.

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError checks if err is ErrorNotFound.

func NewFuncSvcGroup added in v1.19.0

func NewFuncSvcGroup() *funcSvcGroup

Types

type FuncSvc

type FuncSvc struct {
	Name              string                  // Name of object
	Function          *metav1.ObjectMeta      // function this pod/service is for
	Environment       *fv1.Environment        // function's environment
	Address           string                  // Host:Port or IP:Port that the function's service can be reached at.
	KubernetesObjects []apiv1.ObjectReference // Kubernetes Objects (within the function namespace)
	Executor          fv1.ExecutorType
	CPULimit          resource.Quantity

	Ctime time.Time
	Atime time.Time
}

FuncSvc represents a function service

type FunctionServiceCache

type FunctionServiceCache struct {
	PodToFsvc     sync.Map // pod-name -> funcSvc: map[string]*FuncSvc
	WebsocketFsvc sync.Map // funcSvc-name -> bool: map[string]bool
	// contains filtered or unexported fields
}

FunctionServiceCache represents the function service cache

func MakeFunctionServiceCache

func MakeFunctionServiceCache(logger *zap.Logger) *FunctionServiceCache

MakeFunctionServiceCache starts and returns an instance of FunctionServiceCache.

func (*FunctionServiceCache) Add

func (fsc *FunctionServiceCache) Add(fsvc FuncSvc) (*FuncSvc, error)

Add adds a function service to cache if it does not exist already.

func (*FunctionServiceCache) AddFunc added in v1.11.0

func (fsc *FunctionServiceCache) AddFunc(ctx context.Context, fsvc FuncSvc, requestsPerPod, svcsRetain int)

AddFunc adds a function service to pool cache.

func (*FunctionServiceCache) DeleteEntry

func (fsc *FunctionServiceCache) DeleteEntry(fsvc *FuncSvc)

DeleteEntry deletes a function service from cache.

func (*FunctionServiceCache) DeleteFunctionSvc added in v1.11.0

func (fsc *FunctionServiceCache) DeleteFunctionSvc(ctx context.Context, fsvc *FuncSvc)

DeleteFunctionSvc deletes a function service at key composed of [function][address].

func (*FunctionServiceCache) DeleteOld

func (fsc *FunctionServiceCache) DeleteOld(fsvc *FuncSvc, minAge time.Duration) (bool, error)

DeleteOld deletes aged function service entries from cache.

func (*FunctionServiceCache) DeleteOldPoolCache added in v1.11.0

func (fsc *FunctionServiceCache) DeleteOldPoolCache(ctx context.Context, fsvc *FuncSvc, minAge time.Duration) (bool, error)

DeleteOldPoolCache deletes aged function service entries from pool cache.

func (*FunctionServiceCache) DumpDebugInfo added in v1.19.0

func (fsc *FunctionServiceCache) DumpDebugInfo(ctx context.Context) error

DumpDebugInfo => dump function service cache data to temporary directory of executor pod.

func (*FunctionServiceCache) GetByFunction

func (fsc *FunctionServiceCache) GetByFunction(m *metav1.ObjectMeta) (*FuncSvc, error)

GetByFunction gets a function service from cache using function key.

func (*FunctionServiceCache) GetByFunctionUID

func (fsc *FunctionServiceCache) GetByFunctionUID(uid types.UID) (*FuncSvc, error)

GetByFunctionUID gets a function service from cache using function UUID.

func (*FunctionServiceCache) GetFuncSvc added in v1.11.0

func (fsc *FunctionServiceCache) GetFuncSvc(ctx context.Context, m *metav1.ObjectMeta, requestsPerPod int, concurrency int) (*FuncSvc, error)

GetFuncSvc gets a function service from pool cache using function key and returns number of active instances of function pod

func (*FunctionServiceCache) ListOld

func (fsc *FunctionServiceCache) ListOld(age time.Duration) ([]*FuncSvc, error)

ListOld returns a list of aged function services in cache.

func (*FunctionServiceCache) ListOldForPool added in v1.11.0

func (fsc *FunctionServiceCache) ListOldForPool(age time.Duration) ([]*FuncSvc, error)

ListOldForPool returns a list of aged function services in cache for pooling.

func (*FunctionServiceCache) Log

func (fsc *FunctionServiceCache) Log()

Log makes a LOG type cache request.

func (*FunctionServiceCache) MarkAvailable added in v1.11.0

func (fsc *FunctionServiceCache) MarkAvailable(key crd.CacheKeyURG, svcHost string)

MarkAvailable marks the value at key [function][address] as available.

func (*FunctionServiceCache) MarkFuncDeleted added in v1.20.0

func (fsc *FunctionServiceCache) MarkFuncDeleted(key crd.CacheKeyURG)

func (*FunctionServiceCache) MarkSpecializationFailure added in v1.19.0

func (fsc *FunctionServiceCache) MarkSpecializationFailure(key crd.CacheKeyURG)

func (*FunctionServiceCache) SetCPUUtilization added in v1.13.0

func (fsc *FunctionServiceCache) SetCPUUtilization(key crd.CacheKeyURG, svcHost string, cpuUsage resource.Quantity)

func (*FunctionServiceCache) SetCPUUtilizaton added in v1.13.0

func (fsc *FunctionServiceCache) SetCPUUtilizaton(key crd.CacheKeyURG, svcHost string, cpuUsage resource.Quantity)

SetCPUUtilizaton updates/sets CPUutilization in the pool cache

func (*FunctionServiceCache) TouchByAddress

func (fsc *FunctionServiceCache) TouchByAddress(address string) error

TouchByAddress makes a TOUCH request to given address.

type PoolCache added in v1.19.0

type PoolCache struct {
	// contains filtered or unexported fields
}

PoolCache implements a simple cache implementation having values mapped by two keys [function][address]. As of now PoolCache is only used by poolmanager executor

func NewPoolCache added in v1.19.0

func NewPoolCache(logger *zap.Logger) *PoolCache

NewPoolCache create a Cache object

func (*PoolCache) DeleteValue added in v1.19.0

func (c *PoolCache) DeleteValue(ctx context.Context, function crd.CacheKeyURG, address string) error

DeleteValue deletes the value at key composed of [function][address]

func (*PoolCache) GetSvcValue added in v1.19.0

func (c *PoolCache) GetSvcValue(ctx context.Context, function crd.CacheKeyURG, requestsPerPod int, concurrency int) (*FuncSvc, error)

GetValue returns a function service with status in Active else return error

func (*PoolCache) ListAvailableValue added in v1.19.0

func (c *PoolCache) ListAvailableValue() []*FuncSvc

ListAvailableValue returns a list of the available function services stored in the Cache

func (*PoolCache) LogFnSvcGroup added in v1.19.0

func (c *PoolCache) LogFnSvcGroup(ctx context.Context, file io.Writer) error

func (*PoolCache) MarkAvailable added in v1.19.0

func (c *PoolCache) MarkAvailable(function crd.CacheKeyURG, address string)

MarkAvailable marks the value at key [function][address] as available

func (*PoolCache) MarkFuncDeleted added in v1.20.0

func (c *PoolCache) MarkFuncDeleted(function crd.CacheKeyURG)

func (*PoolCache) MarkSpecializationFailure added in v1.19.0

func (c *PoolCache) MarkSpecializationFailure(function crd.CacheKeyURG)

ReduceSpecializationInProgress reduces the svcWaiting count

func (*PoolCache) SetCPUUtilization added in v1.19.0

func (c *PoolCache) SetCPUUtilization(function crd.CacheKeyURG, address string, cpuUsage resource.Quantity)

SetCPUUtilization updates/sets the CPU utilization limit for the pod

func (*PoolCache) SetSvcValue added in v1.19.0

func (c *PoolCache) SetSvcValue(ctx context.Context, function crd.CacheKeyURG, address string, value *FuncSvc, cpuLimit resource.Quantity, requestsPerPod, svcsRetain int)

SetValue marks the value at key [function][address] as active(begin used)

type Queue added in v1.19.0

type Queue struct {
	// contains filtered or unexported fields
}

func NewQueue added in v1.19.0

func NewQueue() *Queue

func (*Queue) Expired added in v1.19.0

func (q *Queue) Expired() int

func (*Queue) Len added in v1.19.0

func (q *Queue) Len() int

func (*Queue) Pop added in v1.19.0

func (q *Queue) Pop() *svcWait

func (*Queue) Push added in v1.19.0

func (q *Queue) Push(item *svcWait)

Jump to

Keyboard shortcuts

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