PMDK C++ bindings
1.13.0-git107.g7e59f08f
This is the C++ bindings documentation for PMDK's libpmemobj.
|
PMEMobj pool class. More...
#include <libpmemobj++/pool.hpp>
Public Member Functions | |
pool () noexcept=default | |
Defaulted constructor. | |
pool (const pool &) noexcept=default | |
Defaulted copy constructor. | |
pool (pool &&) noexcept=default | |
Defaulted move constructor. | |
pool & | operator= (const pool &) noexcept=default |
Defaulted copy assignment operator. | |
pool & | operator= (pool &&) noexcept=default |
Defaulted move assignment operator. | |
~pool () noexcept=default | |
Default destructor. | |
pool (const pool_base &pb) noexcept | |
Defaulted copy constructor. | |
pool (pool_base &&pb) noexcept | |
Defaulted move constructor. | |
template<typename M > | |
M | ctl_get (const std::string &name) |
Query libpmemobj state at pool scope. More... | |
template<typename M > | |
M | ctl_set (const std::string &name, M arg) |
Modify libpmemobj state at pool scope. More... | |
template<typename M > | |
M | ctl_exec (const std::string &name, M arg) |
Execute function at pool scope. More... | |
template<typename M > | |
M | ctl_get (const std::wstring &name) |
Query libpmemobj state at pool scope. More... | |
template<typename M > | |
M | ctl_set (const std::wstring &name, M arg) |
Modify libpmemobj state at pool scope. More... | |
template<typename M > | |
M | ctl_exec (const std::wstring &name, M arg) |
Execute function at pool scope. More... | |
persistent_ptr< T > | root () |
Retrieves pool's root object. More... | |
POBJ_CPP_DEPRECATED persistent_ptr< T > | get_root () |
void | close () |
Closes the pool. More... | |
void | persist (const void *addr, size_t len) noexcept |
Performs persist operation on a given chunk of memory. More... | |
template<typename Y > | |
void | persist (const p< Y > &prop) noexcept |
Performs persist operation on a given pmem property. More... | |
template<typename Y > | |
void | persist (const persistent_ptr< Y > &ptr) noexcept |
Performs persist operation on a given persistent pointer. More... | |
void | flush (const void *addr, size_t len) noexcept |
Performs flush operation on a given chunk of memory. More... | |
template<typename Y > | |
void | flush (const p< Y > &prop) noexcept |
Performs flush operation on a given pmem property. More... | |
template<typename Y > | |
void | flush (const persistent_ptr< Y > &ptr) noexcept |
Performs flush operation on a given persistent object. More... | |
void | drain (void) noexcept |
Performs drain operation. | |
void * | memcpy_persist (void *dest, const void *src, size_t len) noexcept |
Performs memcpy and persist operation on a given chunk of memory. More... | |
void * | memset_persist (void *dest, int c, size_t len) noexcept |
Performs memset and persist operation on a given chunk of memory. More... | |
PMEMobjpool * | handle () noexcept |
Gets the C style handle to the pool. More... | |
POBJ_CPP_DEPRECATED PMEMobjpool * | get_handle () noexcept |
pobj_defrag_result | defrag (persistent_ptr_base **ptrv, size_t oidcnt) |
Starts defragmentation using selected pointers within this pool. More... | |
Static Public Member Functions | |
static pool< T > | open (const std::string &path, const std::string &layout) |
Opens an existing object store memory pool. More... | |
static pool< T > | create (const std::string &path, const std::string &layout, std::size_t size=PMEMOBJ_MIN_POOL, mode_t mode=DEFAULT_MODE) |
Creates a new transactional object store pool. More... | |
static int | check (const std::string &path, const std::string &layout) |
Checks if a given pool is consistent. More... | |
static pool< T > | open (const std::wstring &path, const std::wstring &layout) |
Opens an existing object store memory pool. More... | |
static pool< T > | create (const std::wstring &path, const std::wstring &layout, std::size_t size=PMEMOBJ_MIN_POOL, mode_t mode=DEFAULT_MODE) |
Creates a new transactional object store pool. More... | |
static int | check (const std::wstring &path, const std::wstring &layout) |
Checks if a given pool is consistent. More... | |
Static Protected Member Functions | |
static void | check_pool (pmemobjpool *pop, std::string mode) |
Protected Attributes | |
PMEMobjpool * | pop |
Static Protected Attributes | |
static const int | DEFAULT_MODE = S_IWRITE | S_IREAD |
Default create mode. | |
PMEMobj pool class.
This class is the pmemobj pool handler. It provides basic primitives for operations on pmemobj pools. The template parameter defines the type of the root object within the pool. This pool class inherits also some methods from the base class: pmem::obj::pool_base.
The typical usage example would be:
This API should not be mixed with C API. For example explicitly calling pmemobj_set_user_data(pop) on pool which is handled by C++ pool object is undefined behaviour.
|
inlinestatic |
Checks if a given pool is consistent.
path | System path to the file containing the memory pool or a pool set. |
layout | Unique identifier of the pool as specified at pool creation time. |
|
inlinestatic |
Checks if a given pool is consistent.
Wide string variant. Available only on Windows.
path | System path to the file containing the memory pool or a pool set. |
layout | Unique identifier of the pool as specified at pool creation time. |
|
inlineinherited |
Closes the pool.
std::logic_error | if the pool has already been closed. |
|
inlinestatic |
Creates a new transactional object store pool.
path | System path to the file to be created. If exists the pool can be created in-place depending on the size parameter. Existing file must be zeroed. |
layout | Unique identifier of the pool, can be a null-terminated string. |
size | Size of the pool in bytes. If zero and the file exists the pool is created in-place. |
mode | File mode for the new file. |
pmem::pool_error | when an error during creation occurs. |
|
inlinestatic |
Creates a new transactional object store pool.
Wide string variant. Available only on Windows.
path | System path to the file to be created. If exists the pool can be created in-place depending on the size parameter. Existing file must be zeroed. |
layout | Unique identifier of the pool, can be a null-terminated string. |
size | Size of the pool in bytes. If zero and the file exists the pool is created in-place. |
mode | File mode for the new file. |
pmem::pool_error | when an error during creation occurs. |
|
inline |
Execute function at pool scope.
[in] | name | name of entry point |
[in] | arg | extra argument |
For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3
|
inline |
Execute function at pool scope.
[in] | name | name of entry point |
[in] | arg | extra argument |
For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3
|
inline |
Query libpmemobj state at pool scope.
[in] | name | name of entry point |
For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3
|
inline |
Query libpmemobj state at pool scope.
[in] | name | name of entry point |
For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3
|
inline |
Modify libpmemobj state at pool scope.
[in] | name | name of entry point |
[in] | arg | extra argument |
For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3
|
inline |
Modify libpmemobj state at pool scope.
[in] | name | name of entry point |
[in] | arg | extra argument |
For more details, see: https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_ctl_get.3
|
inlineinherited |
Starts defragmentation using selected pointers within this pool.
[in] | ptrv | pointer to contiguous space containing persistent_ptr's for defrag. |
[in] | oidcnt | number of persistent_ptr's passed (in ptrv). |
pmem::defrag_error | when a failure during defragmentation occurs. Even if this error is thrown, some of the objects could have been relocated, see defrag_error.result for summary stats. |
|
inlinenoexceptinherited |
Performs flush operation on a given pmem property.
[in] | prop | Resides on pmem property |
|
inlinenoexceptinherited |
Performs flush operation on a given persistent object.
[in] | ptr | Persistent pointer to object |
|
inlinenoexceptinherited |
Performs flush operation on a given chunk of memory.
[in] | addr | address of memory chunk |
[in] | len | size of memory chunk |
|
inlinenoexceptinherited |
Gets the C style handle to the pool.
Necessary to be able to use the pool with the C API.
|
inlinenoexceptinherited |
Performs memcpy and persist operation on a given chunk of memory.
[in] | dest | destination memory address |
[in] | src | source memory address |
[in] | len | size of memory chunk |
|
inlinenoexceptinherited |
Performs memset and persist operation on a given chunk of memory.
[in] | dest | destination memory address |
[in] | c | constant value to fill the memory |
[in] | len | size of memory chunk |
|
inlinestatic |
Opens an existing object store memory pool.
path | System path to the file containing the memory pool or a pool set. |
layout | Unique identifier of the pool as specified at pool creation time. |
pmem::pool_error | when an error during opening occurs. |
|
inlinestatic |
Opens an existing object store memory pool.
Wide string variant. Available only on Windows.
path | System path to the file containing the memory pool or a pool set. |
layout | Unique identifier of the pool as specified at pool creation time. |
pmem::pool_error | when an error during opening occurs. |
|
inlinenoexceptinherited |
Performs persist operation on a given pmem property.
[in] | prop | Resides on pmem property |
|
inlinenoexceptinherited |
Performs persist operation on a given persistent pointer.
Persist is not performed on the object referenced by this pointer.
[in] | ptr | Persistent pointer to object |
|
inlinenoexceptinherited |
Performs persist operation on a given chunk of memory.
[in] | addr | address of memory chunk |
[in] | len | size of memory chunk |
|
inline |
Retrieves pool's root object.
pmem::pool_error | when pool handle is incorrect. |