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:
std::shared_ptr<Container> findIdleContainer(const Function *function, const std::set<std::shared_ptr<Container>> &excluded_container) const

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

double getLayerLastAccessDateInRAM(const std::shared_ptr<ImageLayer> &layer) const

Get the last access date for an in-RAM layer.

Parameters:

layer – The layer

Returns:

a date

double getLayerLastAccessDateOnDisk(const std::shared_ptr<ImageLayer> &layer) const

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

bool isImageLayerInRAM(const std::shared_ptr<ImageLayer> &layer) const

Is an image layer in RAM?

Parameters:

layer – an image layer

Returns:

True if the image layer is in RAM

bool isImageLayerOnDisk(const std::shared_ptr<ImageLayer> &layer) const

Is an image layer on disk?

Parameters:

layer – an image layer

Returns:

True if the image is on disk

bool isInvocationFeasible(const std::shared_ptr<Invocation> &invocation, const std::shared_ptr<Container> &target_container) const

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

void makeContainerBusy(const std::shared_ptr<Container> &container)

Make a container busy.

Parameters:

container – a container

void makeContainerIdle(const std::shared_ptr<Container> &container)

Make a container idle.

Parameters:

container – a container

void shutdownContainer(const std::shared_ptr<Container> &container)

Shutdown a container.

Parameters:

container – a container

std::shared_ptr<Container> spawnContainer(const Function *function)

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.