PMEMKV
1.3-git75.g7bf0122
This is the C++ documentation for PMEMKV.
|
Holds configuration parameters for engines. More...
#include <libpmemkv.hpp>
Public Member Functions | |
config () noexcept | |
Default constructor with uninitialized config. More... | |
config (pmemkv_config *cfg) noexcept | |
Creates config from pointer to pmemkv_config. More... | |
~config () | |
Default destructor. More... | |
config (const config &other)=delete | |
config (config &&other) noexcept | |
Move constructor. More... | |
config & | operator= (const config &other)=delete |
config & | operator= (config &&other) noexcept |
Move assignment operator. More... | |
template<typename T > | |
status | put_data (const std::string &key, const T *value, const std::size_t number=1) noexcept |
Puts binary data pointed by value, of type T, with count of elements to a config. More... | |
template<typename T > | |
status | put_object (const std::string &key, T *value, void(*deleter)(void *)) noexcept |
Puts object pointed by value, of type T, with given destructor to a config. More... | |
template<typename T , typename D > | |
status | put_object (const std::string &key, std::unique_ptr< T, D > object) noexcept |
Puts unique_ptr (to an object) to a config. More... | |
status | put_uint64 (const std::string &key, std::uint64_t value) noexcept |
Puts std::uint64_t value to a config. More... | |
status | put_int64 (const std::string &key, std::int64_t value) noexcept |
Puts std::int64_t value to a config. More... | |
status | put_string (const std::string &key, const std::string &value) noexcept |
Puts string value to a config. More... | |
status | put_size (std::uint64_t size) noexcept |
Puts size to a config. More... | |
status | put_path (const std::string &path) noexcept |
Puts path to a config. More... | |
status | put_force_create (bool value) noexcept |
Puts force_create parameter to a config, For supporting engines If false, pmemkv opens file specified by 'path', otherwise it creates it. More... | |
status | put_oid (PMEMoid *oid) noexcept |
Puts PMEMoid object to a config. More... | |
template<typename Comparator > | |
status | put_comparator (Comparator &&comparator) |
Puts comparator object to a config. More... | |
template<typename T > | |
status | get_data (const std::string &key, T *&value, std::size_t &number) const noexcept |
Gets object from a config item with key name and copies it into T object value. More... | |
template<typename T > | |
status | get_object (const std::string &key, T *&value) const noexcept |
Gets binary data from a config item with key name and assigns pointer to T object value. More... | |
status | get_uint64 (const std::string &key, std::uint64_t &value) const noexcept |
Gets std::uint64_t value from a config item with key name. More... | |
status | get_int64 (const std::string &key, std::int64_t &value) const noexcept |
Gets std::int64_t value from a config item with key name. More... | |
status | get_string (const std::string &key, std::string &value) const noexcept |
Gets string value from a config item with key name. More... | |
pmemkv_config * | release () noexcept |
Similarly to std::unique_ptr::release it passes the ownership of underlying pmemkv_config variable and sets it to nullptr. More... | |
Private Member Functions | |
int | init () noexcept |
Initialization function for config. More... | |
Private Attributes | |
pmemkv_config * | _config |
Holds configuration parameters for engines.
It stores mappings of keys (strings) to values. A value can be: uint64_t, int64_t, string, binary data, pointer to an object (with accompanying deleter function).
It also delivers methods to store and read configuration items provided by a user. Once the configuration object is set (with all required parameters),pmemkv_open it can be passed to db::open() method.
List of options which are required by pmemkv database is specific to an engine. Every engine has documented all supported config parameters (please see libpmemkv(7) for details).
|
inlinenoexcept |
Default constructor with uninitialized config.
|
inlineexplicitnoexcept |
Creates config from pointer to pmemkv_config.
Ownership is transferred to config class.
|
inline |
Default destructor.
Deletes config if initialized.
|
delete |
|
inlinenoexcept |
Move constructor.
Initializes config with another config. Ownership is transferred to config class.
|
inlinenoexcept |
Gets object from a config item with key name and copies it into T object value.
[in] | key | The string representing config item's name. |
[out] | value | The pointer to data. |
[out] | count | The count of elements stored under reference. |
|
inlinenoexcept |
Gets std::int64_t value from a config item with key name.
[in] | key | The string representing config item's name. |
[out] | value | The std::int64_t value. |
|
inlinenoexcept |
Gets binary data from a config item with key name and assigns pointer to T object value.
[in] | key | The string representing config item's name. |
[out] | value | The pointer to object. |
|
inlinenoexcept |
Gets string value from a config item with key name.
[in] | key | The string representing config item's name. |
[out] | value | The string value. |
|
inlinenoexcept |
Gets std::uint64_t value from a config item with key name.
[in] | key | The string representing config item's name. |
[out] | value | The std::uint64_t value. |
|
inlineprivatenoexcept |
Initialization function for config.
It's lazy initialized and called within all put functions.
Move assignment operator.
Deletes previous config and replaces it with another config. Ownership is transferred to config class.
|
inline |
Puts comparator object to a config.
Comparator must:
int compare(pmem::kv::string_view, pmem::kv::string_view)
std::string name()
[in] | comparator | forwarding reference to a comparator |
Example of custom comparator:
|
inlinenoexcept |
Puts binary data pointed by value, of type T, with count of elements to a config.
Count parameter is useful for putting arrays of data.
[in] | key | The string representing config item's name. |
[in] | value | The pointer to data. |
[in] | count | The count of elements stored under reference. |
|
inlinenoexcept |
Puts force_create parameter to a config, For supporting engines If false, pmemkv opens file specified by 'path', otherwise it creates it.
False by default.
|
inlinenoexcept |
Puts std::int64_t value to a config.
[in] | key | The string representing config item's name. |
[in] | value | The std::int64_t value. |
|
inlinenoexcept |
Puts unique_ptr (to an object) to a config.
[in] | key | The string representing config item's name. |
[in] | object | unique_ptr to an object. |
|
inlinenoexcept |
Puts object pointed by value, of type T, with given destructor to a config.
[in] | key | The string representing config item's name. |
[in] | value | The pointer to object. |
[in] | deleter | The object's destructor function. |
|
inlinenoexcept |
Puts PMEMoid object to a config.
[in] | oid | pointer (for details see libpmemobj(7)) which points to the engine data. If oid is null engine will allocate new data, otherwise it will use existing one. |
|
inlinenoexcept |
Puts path to a config.
[in] | path | to a database file or to a poolset file (see poolset(5) for details). Note that when using poolset file, size should be 0. |
|
inlinenoexcept |
|
inlinenoexcept |
Puts string value to a config.
[in] | key | The string representing config item's name. |
[in] | value | The string value. |
|
inlinenoexcept |
Puts std::uint64_t value to a config.
[in] | key | The string representing config item's name. |
[in] | value | The std::uint64_t value. |
|
inlinenoexcept |
Similarly to std::unique_ptr::release it passes the ownership of underlying pmemkv_config variable and sets it to nullptr.
|
private |