File InMemoryStateKeyValue.h

namespace faabric
namespace state

WARNING - key-value objects are shared between threads, BUT hiredis is not thread-safe, so make sure you always retrieve the reference to Redis inline rather than sharing a reference within the class.

Enums

enum InMemoryStateKeyStatus

Values:

enumerator NOT_MAIN
enumerator MAIN
class AppendedInMemoryState

Public Functions

inline AppendedInMemoryState(size_t lengthIn, std::unique_ptr<uint8_t[]> &&dataIn)

Public Members

size_t length
std::unique_ptr<uint8_t[]> data
class InMemoryStateKeyValue : public faabric::state::StateKeyValue

Public Functions

InMemoryStateKeyValue(const std::string &userIn, const std::string &keyIn, size_t sizeIn, const std::string &thisIPIn)
InMemoryStateKeyValue(const std::string &userIn, const std::string &keyIn, const std::string &thisIPIn)
bool isMaster()
AppendedInMemoryState &getAppendedValue(uint idx)

Public Static Functions

static size_t getStateSizeFromRemote(const std::string &userIn, const std::string &keyIn, const std::string &thisIPIn)
static void deleteFromRemote(const std::string &userIn, const std::string &keyIn, const std::string &thisIPIn)
static void clearAll(bool global)

Private Functions

virtual void pullFromRemote() override
virtual void pullChunkFromRemote(long offset, size_t length) override
virtual void pushToRemote() override
virtual void pushPartialToRemote(const std::vector<StateChunk> &dirtyChunks) override
virtual void appendToRemote(const uint8_t *data, size_t length) override
virtual void pullAppendedFromRemote(uint8_t *data, size_t length, long nValues) override
virtual void clearAppendedFromRemote() override

Private Members

const std::string thisIP
const std::string mainIP
InMemoryStateKeyStatus status
InMemoryStateRegistry &stateRegistry
std::vector<AppendedInMemoryState> appendedData