Class ParallaxBackend

Inheritance Relationships

Base Type

Class Documentation

class gkfs::metadata::ParallaxBackend : public gkfs::metadata::MetadataBackend<ParallaxBackend>

Public Functions

explicit ParallaxBackend(const std::string &path)

Called when the daemon is started: Connects to the KV store

Parameters

path – where KV store data is stored

virtual ~ParallaxBackend()

Destroy the Kreon Backend:: Kreon Backend object We remove the file, too large for the CI. TODO: Insert option.

std::string get_impl(const std::string &key) const

Gets a KV store value for a key

Parameters

key

Throws

DBException – on failure, NotFoundException if entry doesn’t exist

Returns

value

void put_impl(const std::string &key, const std::string &val)

Puts an entry into the KV store

Parameters
  • key

  • val

Throws

DBException – on failure

void put_no_exist_impl(const std::string &key, const std::string &val)

Puts an entry into the KV store if it doesn’t exist. This function does not use a mutex.

Parameters
  • key

  • val

Throws

DBException – on failure, ExistException if entry already exists

void remove_impl(const std::string &key)

Removes an entry from the KV store

Parameters

key

Throws

DBException – on failure, NotFoundException if entry doesn’t exist

bool exists_impl(const std::string &key)

checks for existence of an entry

Parameters

key

Throws

DBException – on failure

Returns

true if exists

void update_impl(const std::string &old_key, const std::string &new_key, const std::string &val)

Updates a metadentry atomically and also allows to change keys

Parameters
  • old_key

  • new_key

  • val

Throws

DBException – on failure, NotFoundException if entry doesn’t exist

off_t increase_size_impl(const std::string &key, size_t io_size, off_t offset, bool append)

Updates the size on the metadata Operation. E.g., called before a write() call

Updates the size on the metadata Operation. E.g., called before a write() call

Parameters
  • key

  • io_size

  • offset

  • append

  • key

  • size

  • append

Throws

DBException – on failure

Returns

offset where the write operation should start. This is only used when append is set

void decrease_size_impl(const std::string &key, size_t size)

Decreases the size on the metadata Operation E.g., called before a truncate() call

Parameters
  • key

  • size

Throws

DBException – on failure

std::vector<std::pair<std::string, bool>> get_dirents_impl(const std::string &dir) const
std::vector<std::tuple<std::string, bool, size_t, time_t>> get_dirents_extended_impl(const std::string &dir) const
void iterate_all_impl() const

Code example for iterating all entries in KV store. This is for debug only as it is too expensive

Public Static Functions

static inline void throw_status_excpt(const std::string &s)

Exception wrapper on Status object. Throws NotFoundException if s == “Not Found”, general DBException otherwise

Parameters

String – with status

Throws

DBException

Private Functions

inline void str2par(const std::string &value, struct par_value &V) const

Convert a String to klc_key

Convert a String to klc_value

Parameters
  • key

  • klc_key – struct

  • value

  • par_value – struct

inline void str2par(const std::string &key, struct par_key &K) const

Convert a String to klc_value

Convert a String to klc_key

Parameters
  • value

  • klc_value – struct

  • key

  • par_key – struct

Private Members

par_handle par_db_
par_db_options par_options_
std::string par_path_