wrench::ServerlessComputeNode
-
class ServerlessComputeNode
A class that stores the state of a serverless compute node.
Public Functions
-
ServerlessComputeNode(std::string h, unsigned int num_cores, ServerlessComputeService *service)
Constructor.
- Parameters:
h – hostname
num_cores – number of cores
service – the ServerlessComputeService that owns this compute node
Method to see if there is an appropriate idle container.
- Parameters:
function – the target function
excluded_container – set containers to ignore
- Returns:
A container, if found, or nullptr
-
std::set<std::shared_ptr<Container>> &getBusyContainers()
Retrieve the set of non-idle containers.
- Returns:
A set of containers
-
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
-
std::set<std::shared_ptr<Container>> &getIdleContainers()
Retrieve the set of idle 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
-
std::shared_ptr<SimpleStorageService> getMemoryStorage() const
Get the compute node’s RAM storage.
- Returns:
A storage service
-
unsigned int getNumCores() const
Get the compute node’s number of cores.
- Returns:
a number of cores
-
unsigned int getNumIdleCores() const
Get the compute node’s number of idle cores.
- Returns:
a number of cores
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
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
Make a container busy.
- Parameters:
container – a container
Make a container idle.
- Parameters:
container – a container
Shutdown a container.
- Parameters:
container – a container
Public Members
-
const std::string hostname
The hostname of the compute node.
-
ServerlessComputeNode(std::string h, unsigned int num_cores, ServerlessComputeService *service)