Documentation
¶
Index ¶
- Variables
- func AcquireResources(cpuDemand float64, memDemand int64, destroyContainersIfNeeded bool) bool
- func AcquireWarmContainer(f *function.Function) (container.ContainerID, error)
- func DeleteExpiredContainer()
- func GetJanitorInstance() *janitor
- func NewContainer(fun *function.Function) (container.ContainerID, error)
- func NewContainerWithAcquiredResources(fun *function.Function) (container.ContainerID, error)
- func ReleaseContainer(contID container.ContainerID, f *function.Function)
- func ShutdownAllContainers()
- func ShutdownWarmContainersFor(f *function.Function)
- func StopJanitor()
- func WarmStatus() map[string]int
- type ContainerPool
- type NodeResources
Constants ¶
This section is empty.
Variables ¶
var (
Instance *janitor
)
var NoWarmFoundErr = errors.New("no warm container is available")
var NodeIdentifier string
var OutOfResourcesErr = errors.New("not enough resources for function execution")
Functions ¶
func AcquireResources ¶
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 ¶
ShutdownWarmContainersFor destroys warm containers of a given function Actual termination happens asynchronously.
func StopJanitor ¶
func StopJanitor()
func WarmStatus ¶
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