The non-template pool base class.
More...
#include <libpmemobj++/pool.hpp>
|
| pool_base () noexcept |
| Defaulted constructor.
|
|
| pool_base (pmemobjpool *cpop) noexcept |
| Explicit constructor. More...
|
|
| pool_base (const pool_base &) noexcept=default |
| Defaulted copy constructor.
|
|
| pool_base (pool_base &&) noexcept=default |
| Defaulted move constructor.
|
|
pool_base & | operator= (const pool_base &) noexcept=default |
| Defaulted copy assignment operator.
|
|
pool_base & | operator= (pool_base &&) noexcept=default |
| Defaulted move assignment operator.
|
|
virtual | ~pool_base () noexcept=default |
| Default virtual destructor.
|
|
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 object. 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...
|
|
|
static pool_base | open (const std::string &path, const std::string &layout) |
| Opens an existing object store memory pool. More...
|
|
static pool_base | 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) noexcept |
| Checks if a given pool is consistent. More...
|
|
static pool_base | open (const std::wstring &path, const std::wstring &layout) |
| Opens an existing object store memory pool. More...
|
|
static pool_base | 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) noexcept |
| Checks if a given pool is consistent. More...
|
|
The non-template pool base class.
This class is a non-template version of pool. It is useful for places where providing pool template argument is undesirable. The typical usage example would be:
#include <fcntl.h>
using namespace pmem::obj;
void
pool_base_example()
{
struct some_struct {
};
pop.close();
make_persistent_atomic<some_struct>(pop, pval);
pval->some_variable = 3;
pop.memset_persist(pval->some_array, 2, sizeof(pval->some_array));
pop.memcpy_persist(pval->some_other_array, pval->some_array,
sizeof(pval->some_array));
pop.close();
}
◆ pool_base()
pmem::obj::pool_base::pool_base |
( |
pmemobjpool * |
cpop | ) |
|
|
inlineexplicitnoexcept |
Explicit constructor.
Create pool_base object based on C-style pool handle.
- Parameters
-
◆ check() [1/2]
static int pmem::obj::pool_base::check |
( |
const std::string & |
path, |
|
|
const std::string & |
layout |
|
) |
| |
|
inlinestaticnoexcept |
Checks if a given pool is consistent.
- Parameters
-
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. |
- Returns
- -1 on error, 1 if file is consistent, 0 otherwise.
◆ check() [2/2]
static int pmem::obj::pool_base::check |
( |
const std::wstring & |
path, |
|
|
const std::wstring & |
layout |
|
) |
| |
|
inlinestaticnoexcept |
Checks if a given pool is consistent.
Wide string variant. Available only on Windows.
- Parameters
-
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. |
- Returns
- -1 on error, 1 if file is consistent, 0 otherwise.
◆ close()
void pmem::obj::pool_base::close |
( |
| ) |
|
|
inline |
Closes the pool.
- Exceptions
-
std::logic_error | if the pool has already been closed. |
◆ create() [1/2]
static pool_base pmem::obj::pool_base::create |
( |
const std::string & |
path, |
|
|
const std::string & |
layout, |
|
|
std::size_t |
size = PMEMOBJ_MIN_POOL , |
|
|
mode_t |
mode = DEFAULT_MODE |
|
) |
| |
|
inlinestatic |
Creates a new transactional object store pool.
- Parameters
-
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. |
- Returns
- handle to the created pool.
- Exceptions
-
◆ create() [2/2]
static pool_base pmem::obj::pool_base::create |
( |
const std::wstring & |
path, |
|
|
const std::wstring & |
layout, |
|
|
std::size_t |
size = PMEMOBJ_MIN_POOL , |
|
|
mode_t |
mode = DEFAULT_MODE |
|
) |
| |
|
inlinestatic |
Creates a new transactional object store pool.
Wide string variant. Available only on Windows.
- Parameters
-
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. |
- Returns
- handle to the created pool.
- Exceptions
-
◆ flush() [1/3]
template<typename Y >
void pmem::obj::pool_base::flush |
( |
const p< Y > & |
prop | ) |
|
|
inlinenoexcept |
Performs flush operation on a given pmem property.
- Parameters
-
[in] | prop | Resides on pmem property |
◆ flush() [2/3]
Performs flush operation on a given persistent object.
- Parameters
-
[in] | ptr | Persistent pointer to object |
◆ flush() [3/3]
void pmem::obj::pool_base::flush |
( |
const void * |
addr, |
|
|
size_t |
len |
|
) |
| |
|
inlinenoexcept |
Performs flush operation on a given chunk of memory.
- Parameters
-
[in] | addr | address of memory chunk |
[in] | len | size of memory chunk |
◆ handle()
PMEMobjpool* pmem::obj::pool_base::handle |
( |
| ) |
|
|
inlinenoexcept |
Gets the C style handle to the pool.
Necessary to be able to use the pool with the C API.
- Returns
- pool opaque handle.
◆ memcpy_persist()
void* pmem::obj::pool_base::memcpy_persist |
( |
void * |
dest, |
|
|
const void * |
src, |
|
|
size_t |
len |
|
) |
| |
|
inlinenoexcept |
Performs memcpy and persist operation on a given chunk of memory.
- Parameters
-
[in] | dest | destination memory address |
[in] | src | source memory address |
[in] | len | size of memory chunk |
- Returns
- A pointer to dest
◆ memset_persist()
void* pmem::obj::pool_base::memset_persist |
( |
void * |
dest, |
|
|
int |
c, |
|
|
size_t |
len |
|
) |
| |
|
inlinenoexcept |
Performs memset and persist operation on a given chunk of memory.
- Parameters
-
[in] | dest | destination memory address |
[in] | c | constant value to fill the memory |
[in] | len | size of memory chunk |
- Returns
- A pointer to dest
◆ open() [1/2]
static pool_base pmem::obj::pool_base::open |
( |
const std::string & |
path, |
|
|
const std::string & |
layout |
|
) |
| |
|
inlinestatic |
Opens an existing object store memory pool.
- Parameters
-
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. |
- Returns
- handle to the opened pool.
- Exceptions
-
◆ open() [2/2]
static pool_base pmem::obj::pool_base::open |
( |
const std::wstring & |
path, |
|
|
const std::wstring & |
layout |
|
) |
| |
|
inlinestatic |
Opens an existing object store memory pool.
Wide string variant. Available only on Windows.
- Parameters
-
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. |
- Returns
- handle to the opened pool.
- Exceptions
-
◆ persist() [1/3]
template<typename Y >
void pmem::obj::pool_base::persist |
( |
const p< Y > & |
prop | ) |
|
|
inlinenoexcept |
Performs persist operation on a given pmem property.
- Parameters
-
[in] | prop | Resides on pmem property |
◆ persist() [2/3]
Performs persist operation on a given persistent object.
- Parameters
-
[in] | ptr | Persistent pointer to object |
◆ persist() [3/3]
void pmem::obj::pool_base::persist |
( |
const void * |
addr, |
|
|
size_t |
len |
|
) |
| |
|
inlinenoexcept |
Performs persist operation on a given chunk of memory.
- Parameters
-
[in] | addr | address of memory chunk |
[in] | len | size of memory chunk |
The documentation for this class was generated from the following file:
static pool_base 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.
Definition: pool.hpp:155