Namespace faabric::executor

namespace executor

Functions

void setExecutorFactory(std::shared_ptr<ExecutorFactory> fac)
std::shared_ptr<ExecutorFactory> getExecutorFactory()

Variables

static thread_local std::shared_ptr<ExecutorContext> context = nullptr
static std::shared_ptr<ExecutorFactory> _factory
class ChainedCallException : public faabric::util::FaabricException

Public Functions

inline explicit ChainedCallException(std::string message)
class Executor

Public Functions

explicit Executor(faabric::Message &msg)
virtual ~Executor()
void executeTasks(std::vector<int> msgIdxs, std::shared_ptr<faabric::BatchExecuteRequest> req)
virtual void shutdown()

Shuts down the executor and clears all its state, including its thread pool.

This must be called before destructing an executor. This is because the tidy-up requires implementations of virtual methods held in subclasses, that may depend on state that those subclass instances hold. Because destructors run in inheritance order, this means that state may have been destructed before the executor destructor runs.

virtual void reset(faabric::Message &msg)
virtual int32_t executeTask(int threadPoolIdx, int msgIdx, std::shared_ptr<faabric::BatchExecuteRequest> req)
bool tryClaim()
void claim()
void releaseClaim()
std::shared_ptr<faabric::util::SnapshotData> getMainThreadSnapshot(faabric::Message &msg, bool createIfNotExists = false)
long getMillisSinceLastExec()
virtual std::span<uint8_t> getMemoryView()
virtual void restore(const std::string &snapshotKey)
faabric::Message &getBoundMessage()
bool isExecuting()
inline bool isShutdown()
void addChainedMessage(const faabric::Message &msg)
const faabric::Message &getChainedMessage(int messageId)
std::set<unsigned int> getChainedMessageIds()
std::vector<faabric::util::SnapshotDiff> mergeDirtyRegions(const Message &msg, const std::vector<char> &extraDirtyPages = {})
void setThreadResult(faabric::Message &msg, int32_t returnValue, const std::string &key, const std::vector<faabric::util::SnapshotDiff> &diffs)
virtual void setMemorySize(size_t newSize)

Public Members

std::string id
class ExecutorContext
#include <ExecutorContext.h>

Globally-accessible wrapper that allows executing applications to query their execution context. The context is thread-local, so applications can query which specific message they are executing.

Public Functions

ExecutorContext(Executor *executorIn, std::shared_ptr<faabric::BatchExecuteRequest> reqIn, int msgIdx)
inline Executor *getExecutor()
inline std::shared_ptr<faabric::BatchExecuteRequest> getBatchRequest()
inline faabric::Message &getMsg()
inline int getMsgIdx()

Public Static Functions

static bool isSet()
static void set(Executor *executorIn, std::shared_ptr<faabric::BatchExecuteRequest> reqIn, int msgIdxIn)
static void unset()
static std::shared_ptr<ExecutorContext> get()
class ExecutorContextException : public faabric::util::FaabricException

Public Functions

inline explicit ExecutorContextException(std::string message)
class ExecutorFactory

Public Functions

inline virtual ~ExecutorFactory()
virtual std::shared_ptr<Executor> createExecutor(faabric::Message &msg) = 0
virtual void flushHost()
class ExecutorTask

Public Functions

ExecutorTask() = default
ExecutorTask(int messageIndexIn, std::shared_ptr<BatchExecuteRequest> reqIn)
ExecutorTask(const ExecutorTask &other) = delete
ExecutorTask &operator=(const ExecutorTask &other) = delete
ExecutorTask(ExecutorTask &&other) = default
ExecutorTask &operator=(ExecutorTask &&other) = default

Public Members

std::shared_ptr<BatchExecuteRequest> req
int messageIndex = 0