fscache

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: Apache-2.0 Imports: 17 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.

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)

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) 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) (*FuncSvc, int, error)

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

func (*FunctionServiceCache) IdleTime added in v1.13.0

func (fsc *FunctionServiceCache) IdleTime(funcName, funcAddress string, time float64)

IdleTime is the amount of time it took Reaper to find out the pod was idle

func (*FunctionServiceCache) IncreaseColdStarts

func (fsc *FunctionServiceCache) IncreaseColdStarts(funcname, funcuid string)

IncreaseColdStarts increments the counter by 1.

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 serices 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 string, svcHost string)

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

func (*FunctionServiceCache) ReapTime added in v1.13.0

func (fsc *FunctionServiceCache) ReapTime(funcName, funcAddress string, time float64)

ReapTime is the amount of time taken to reap a pod

func (*FunctionServiceCache) SetCPUUtilization added in v1.13.0

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

func (*FunctionServiceCache) SetCPUUtilizaton added in v1.13.0

func (fsc *FunctionServiceCache) SetCPUUtilizaton(key string, 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.

Jump to

Keyboard shortcuts

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