wrench::Function

class Function

A class that implements the notion of a function that can be invoked at a serverless compute service.

Public Functions

Function(const std::string &name, const std::function<std::shared_ptr<FunctionOutput>(const std::shared_ptr<FunctionInput>&, const std::shared_ptr<StorageService>&)> &lambda, const std::shared_ptr<FileLocation> &image)

Constructs a Function object.

Parameters:
  • name – The name of the function.

  • lambda – The function logic implemented as a lambda.

  • image – The file location of the function’s container image.

std::shared_ptr<FunctionOutput> execute(const std::shared_ptr<FunctionInput> &input, const std::shared_ptr<StorageService> &storage_service) const

Executes the function with the provided input and storage service.

Parameters:
  • input – The input string for the function.

  • storage_service – A shared pointer to a StorageService instance.

Returns:

The output of the function execution.

std::shared_ptr<FileLocation> getImage() const

Gets the image associated to the function.

Returns:

An image’s file location

std::string getName() const

Gets the name of the function.

Returns:

The name of the function.