File StateKeyValue.h
Defines
-
STATE_STREAMING_CHUNK_SIZE
Functions
- constexpr int REMOTE_LOCK_TIMEOUT_SECS (1)
- constexpr int REMOTE_LOCK_MAX_RETRIES (100)
-
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.
-
class StateChunk
Public Functions
-
inline StateChunk(long offsetIn, size_t lengthIn, uint8_t *dataIn)
-
inline StateChunk(long offsetIn, std::vector<uint8_t> &data)
Public Members
-
long offset
-
size_t length
-
uint8_t *data
-
inline StateChunk(long offsetIn, size_t lengthIn, uint8_t *dataIn)
-
class StateKeyValue
Subclassed by faabric::state::InMemoryStateKeyValue, faabric::state::RedisStateKeyValue
Public Functions
-
StateKeyValue(const std::string &userIn, const std::string &keyIn, size_t sizeIn)
-
StateKeyValue(const std::string &userIn, const std::string &keyIn)
-
void get(uint8_t *buffer)
-
uint8_t *get()
-
void getChunk(long offset, uint8_t *buffer, size_t length)
-
uint8_t *getChunk(long offset, long len)
-
std::vector<StateChunk> getAllChunks()
-
void set(const uint8_t *buffer)
-
void setChunk(long offset, const uint8_t *buffer, size_t length)
-
void append(const uint8_t *buffer, size_t length)
-
void getAppended(uint8_t *buffer, size_t length, long nValues)
-
void clearAppended()
-
void pull()
-
void pushPartial()
-
void lockRead()
-
void unlockRead()
-
void lockWrite()
-
void unlockWrite()
-
void flagDirty()
-
void flagChunkDirty(long offset, long len)
-
size_t size() const
-
void pushFull()
Public Members
-
const std::string user
-
const std::string key
Public Static Functions
-
static uint32_t waitOnRedisRemoteLock(const std::string &redisKey)
Protected Functions
-
void doSet(const uint8_t *data)
-
void doSetChunk(long offset, const uint8_t *buffer, size_t length)
-
virtual void pullFromRemote() = 0
-
virtual void pullChunkFromRemote(long offset, size_t length) = 0
-
virtual void pushToRemote() = 0
-
virtual void appendToRemote(const uint8_t *data, size_t length) = 0
-
virtual void pullAppendedFromRemote(uint8_t *data, size_t length, long nValues) = 0
-
virtual void clearAppendedFromRemote() = 0
-
virtual void pushPartialToRemote(const std::vector<StateChunk> &dirtyChunks) = 0
Private Functions
-
void zeroDirtyMask()
-
void configureSize()
-
void checkSizeConfigured()
-
void markDirtyChunk(long offset, long len)
-
bool isChunkPulled(long offset, size_t length)
-
void allocateChunk(long offset, size_t length)
-
void reserveStorage()
-
void doPull(bool lazy)
-
void doPullChunk(bool lazy, long offset, size_t length)
-
void doPushPartial(const uint8_t *dirtyMaskBytes)
-
std::vector<StateChunk> getDirtyChunks(const uint8_t *dirtyMaskBytes)
-
StateKeyValue(const std::string &userIn, const std::string &keyIn, size_t sizeIn)
-
class StateKeyValueException : public runtime_error
Public Functions
-
inline explicit StateKeyValueException(const std::string &message)
-
inline explicit StateKeyValueException(const std::string &message)
-
class StateChunk
-
namespace state