node

package
v1.0.0-percom23 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Instance *janitor
)
View Source
var NoWarmFoundErr = errors.New("no warm container is available")
View Source
var NodeIdentifier string
View Source
var OutOfResourcesErr = errors.New("not enough resources for function execution")

Functions

func AcquireResources

func AcquireResources(cpuDemand float64, memDemand int64, destroyContainersIfNeeded bool) bool

AcquireResources reserves the specified amount of cpu and memory if possible.

func AcquireWarmContainer

func AcquireWarmContainer(f *function.Function) (container.ContainerID, error)

AcquireWarmContainer acquires a warm container for a given function (if any). A warm container is in running/paused state and has already been initialized with the function code. The acquired container is already in the busy pool. The function returns an error if either: (i) the warm container does not exist (ii) there are not enough resources to start the container

func DeleteExpiredContainer

func DeleteExpiredContainer()

DeleteExpiredContainer is called by the container cleaner Deletes expired warm container

func GetJanitorInstance

func GetJanitorInstance() *janitor

GetJanitorInstance : singleton implementation to retrieve THE container janitor

func NewContainer

func NewContainer(fun *function.Function) (container.ContainerID, error)

NewContainer creates and starts a new container for the given function. The container can be directly used to schedule a request, as it is already in the busy pool.

func NewContainerWithAcquiredResources

func NewContainerWithAcquiredResources(fun *function.Function) (container.ContainerID, error)

NewContainerWithAcquiredResources spawns a new container for the given function, assuming that the required CPU and memory resources have been already been acquired.

func ReleaseContainer

func ReleaseContainer(contID container.ContainerID, f *function.Function)

ReleaseContainer puts a container in the ready pool for a function.

func ShutdownAllContainers

func ShutdownAllContainers()

ShutdownAllContainers destroys all container (usually on termination)

func ShutdownWarmContainersFor

func ShutdownWarmContainersFor(f *function.Function)

ShutdownWarmContainersFor destroys warm containers of a given function Actual termination happens asynchronously.

func StopJanitor

func StopJanitor()

func WarmStatus

func WarmStatus() map[string]int

WarmStatus foreach function returns the corresponding number of warm container available

Types

type ContainerPool

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

type NodeResources

type NodeResources struct {
	sync.RWMutex
	AvailableMemMB int64
	AvailableCPUs  float64
	DropCount      int64
	ContainerPools map[string]*ContainerPool
}
var Resources NodeResources

func (NodeResources) String

func (n NodeResources) String() string

Jump to

Keyboard shortcuts

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