wrench::ServerlessComputeNode
-
class ServerlessComputeNode
A class that stores the state of a serverless compute node.
Public Functions
-
ServerlessComputeNode(std::string h, ServerlessComputeService *service)
Constructor.
- Parameters:
h – hostname
service – the ServerlessComputeService that owns this compute node
Make the compute node aware that an invocation has completed.
- Parameters:
invocation – An invocation
Make the compute node aware that an invocation has started.
- Parameters:
invocation – An invocation
-
bool areAllContainersAtInvocationLimit() const
Determine whether all initialized containers on the compute node are at their invocation limit.
- Returns:
true if no new invocation could be started on any container on this node, false otherwise
Helper method to ensure that an invocation can be dispatched.
- Parameters:
invocation – the invocation to start
target_container – the target container (nullptr if none)
- Returns:
true if the invocation can be dispatched, false otherwise
-
std::shared_ptr<SimpleStorageService> getDiskStorage() const
Get the compute node’s disk storage.
- Returns:
A storage service
-
sg_size_t getFreeDiskSpace() const
Get the compute node’s free disk space.
- Returns:
a number of bytes
-
sg_size_t getFreeRAMSpace() const
Get the compute node’s free RAM space.
- Returns:
a number of bytes
-
const std::set<std::shared_ptr<Container>> &getInitializedContainers() const
Retrieve the set of initialized containers.
- Returns:
A set of containers
-
const std::set<std::shared_ptr<Container>> &getInitializingContainers() const
Retrieve the set of initializing containers.
- Returns:
A set of containers
Get the last access date for an in-RAM layer.
- Parameters:
layer – The layer
- Returns:
a date
Get the last access date for an in-disk layer.
- Parameters:
layer – The layer
- Returns:
a date
-
unsigned long getMaxNumContainers() const
Get the maximum number of containers for this compute node.
- Returns:
The maximum number of containers for this compute node
-
unsigned long getMaxNumInvocations() const
Get the maximum number of invocations for this compute node.
- Returns:
The maximum number of invocations for this compute node
-
std::shared_ptr<SimpleStorageService> getMemoryStorage() const
Get the compute node’s RAM storage.
- Returns:
A storage service
-
unsigned long getTotalNumContainers() const
Get the total number of containers (initializing and initialized) on this compute node.
- Returns:
The current number of containers
-
bool isAtPerNodeContainerLimit() const
Determine whether the compute node is at its container limit.
- Returns:
true if no container could be started on this node, false otherwise
-
bool isAtPerNodeInvocationLimit() const
Determine whether the compute node is at its invocation limit (this counts invocations assigned to initializing containers).
- Returns:
true if no new invocation could be started on this node, false otherwise
Is an image layer in RAM?
- Parameters:
layer – an image layer
- Returns:
True if the image layer is in RAM
Is an image layer on disk?
- Parameters:
layer – an image layer
- Returns:
True if the image is on disk
Shutdown a container.
- Parameters:
container – a container
Spawn a container (and try to kill idle containers if it helps).
- Parameters:
function – a function
- Returns:
A container
Public Members
-
const std::string hostname
The hostname of the compute node.
-
ServerlessComputeNode(std::string h, ServerlessComputeService *service)