PMDK C++ bindings
1.13.0-git107.g7e59f08f
This is the C++ bindings documentation for PMDK's libpmemobj.
|
Persistent memory aware implementation of multi producer single consumer queue. More...
#include <libpmemobj++/experimental/mpsc_queue.hpp>
Classes | |
class | batch_type |
Type representing the range of the mpsc_queue elements. More... | |
class | pmem_log_type |
Type representing persistent data, which may be managed by mpsc_queue. More... | |
class | worker |
mpsc_queue producer worker class. More... | |
Public Member Functions | |
mpsc_queue (pmem_log_type &pmem, size_t max_workers=1) | |
mpsc_queue constructor. More... | |
worker | register_worker () |
Registers the producer worker. More... | |
template<typename Function > | |
bool | try_consume_batch (Function &&f) |
Evaluates callback function f() for the data, which is ready to be consumed. More... | |
Persistent memory aware implementation of multi producer single consumer queue.
In case of crash or shutdown, reading and writing may be continued by a new process, from the last position, without losing any already produced data.
Example:
pmem::obj::experimental::mpsc_queue::mpsc_queue | ( | pmem_log_type & | pmem, |
size_t | max_workers = 1 |
||
) |
mpsc_queue constructor.
[in] | pmem | reference to already allocated pmem_log_type object |
[in] | max_workers | maximum number of workers which may be added to mpsc_queue at the same time. |
|
inline |
Registers the producer worker.
Number of workers have to be less or equal to max_workers specified in the mpsc_queue constructor.
|
inline |
Evaluates callback function f() for the data, which is ready to be consumed.
try_consume_batch() accesses data and evaluates callback inside a transaction. If an exception is thrown within callback, it gets propagated to the caller and causes a transaction abort. In such case, next try_consume_batch() call would consume the same data.
transaction_scope_error |