Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 7e59f08

Browse files
Merge pull request #1242 from lukaszstolarczuk/docs-update
Docs update
2 parents a74879b + 01b71fa commit 7e59f08

File tree

2 files changed

+58
-34
lines changed

2 files changed

+58
-34
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ We take outside code contributions to `libpmemobj-cpp` through GitHub pull reque
4747
If you add a new feature or fix a critical bug please append appropriate entry
4848
to ChangeLog under newest release.
4949

50+
## Choosing the correct branch
51+
52+
Development of new features is done on `master` branch. High priority bug fixes are done on
53+
the oldest relevant `stable-*` branch and merged through newer stable branches up to the `master`.
54+
55+
## Licence and Developer's Certificate of Origin
56+
5057
**NOTE: If you do decide to implement code changes and contribute them,
5158
please make sure you agree your contribution can be made available under the
5259
[BSD-style License used for libpmemobj-cpp](LICENSE).**

doc/groups_definitions.dox

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: BSD-3-Clause
2-
# Copyright 2021, Intel Corporation
2+
# Copyright 2021-2022, Intel Corporation
33

44
/** @defgroup containers Containers
55
* Custom (but STL-like) containers for persistent memory.
@@ -18,7 +18,7 @@
1818
* There is a separate Feature describing and listing all
1919
* experimental containers, see @ref experimental_containers.
2020
*
21-
* # Rationale for implementing pmem-aware containers
21+
* ## Rationale for implementing pmem-aware containers
2222
*
2323
* The C++ standard library containers collection is something that persistent
2424
* memory programmers may want to use. Containers manage the lifetime of held
@@ -43,7 +43,7 @@
4343
* internal implementation details, libpmemobj-cpp persistent memory containers
4444
* have the well-known STL-like interface and they work with STL algorithms.
4545
*
46-
* # Additional resources
46+
* ## Additional resources
4747
* - [Blog post on pmem.io about libpmemobj-cpp persistent containers](https://pmem.io/2018/11/20/cpp-persistent-containers.html)
4848
* - [A blog post about array container](https://pmem.io/2018/11/02/cpp-array.html)
4949
* - [Very first description of (then yet experimental) vector container](https://pmem.io/2019/02/20/cpp-vector.html)
@@ -73,7 +73,7 @@
7373
/** @defgroup transactions Transactions
7474
* Transactional approach to store data on pmem.
7575
*
76-
* # General info about transactions
76+
* ## General info about transactions
7777
*
7878
* The heart of the libpmemobj are transactions. A transaction is defined as series of operations on
7979
* **persistent memory objects** that either all occur, or nothing occurs. In particular, if the execution
@@ -106,9 +106,6 @@
106106
* All operations between creating and destroying the transaction
107107
* object are treated as performed in a transaction block and
108108
* can be rolled back.
109-
* The locks are held for the entire duration of the transaction. They
110-
* are released at the end of the scope, so within the `catch` block,
111-
* they are already unlocked.
112109
* The best way to use manual transactions is by
113110
* @ref pmem::obj::transaction::run, which is used in example above.
114111
*
@@ -117,14 +114,15 @@
117114
* performed in a transaction block and can be rolled back.
118115
* If you have a C++17 compliant compiler, the automatic transaction will
119116
* commit and abort automatically depending on the context of object's destruction.
120-
* The locks are held for the entire duration of the transaction. They
121-
* are released at the end of the scope, so within the `catch` block,
117+
*
118+
* In both approaches one of the parameters is the `locks`. They are held for the entire duration
119+
* of the transaction and they are released at the end of the scope - so within the `catch` block,
122120
* they are already unlocked.
123121
*
124122
* If you want to read more and see example usages of both, you have to see
125123
* flat or basic transaction documentation, because each implementation may differ.
126124
*
127-
* # Lifecycle and stages:
125+
* ## Lifecycle and stages:
128126
*
129127
* When you are using transaction API a transaction can be in one of the following states:
130128
* - *TX_STAGE_NONE* - no open transaction in this thread
@@ -137,14 +135,14 @@
137135
* in libpmemobj-cpp it's transparent for user, so please focus on relationships between stages.
138136
* Look at the diagram below:
139137
*
140-
* ![lifecycle](https://pmem.io/assets/lifecycle.png "Transaction lifecycle")
138+
* ![lifecycle](https://pmem.io/images/posts/lifecycle.png "Transaction lifecycle")
141139
*
142140
* To be more familiar with functions used in diagram read e.g. **pmemobj_tx_begin**(3) manpage
143141
* (C API for [libpmemobj](https://pmem.io/pmdk/libpmemobj/), link below in *Additional resources*).
144142
*
145143
* If you need to read general information about transaction move to the *Additional resources* section.
146144
*
147-
* # Example of flat_transaction
145+
* ## Example of flat_transaction
148146
* For comparison with the previous snippet, here is a code snippet of
149147
* @ref pmem::obj::flat_transaction which is listed below with basic explanation inline.
150148
* @snippet transaction/transaction.cpp tx_nested_struct_example
@@ -153,7 +151,7 @@
153151
* For more examples please look at the
154152
* [examples directory](https://github.com/pmem/libpmemobj-cpp/tree/master/examples) in libpmemobj-cpp repository.
155153
*
156-
* # Additional resources
154+
* ## Additional resources
157155
* - [pmemobj_tx_begin(3) manpage with transaction description (C API)](https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_tx_begin.3)
158156
* - [blog post about transactions](https://pmem.io/2016/05/25/cpp-07.html)
159157
* - [blog post about transactional allocations](https://pmem.io/2016/05/19/cpp-06.html)
@@ -191,22 +189,40 @@
191189
* take a look at description of each class to get the details of their behavior.
192190
*/
193191

194-
/** @defgroup synchronization Synchronization Primitives*/
192+
/** @defgroup synchronization Synchronization Primitives
193+
* Persistent memory resident implementation of synchronization primitives.
194+
*
195+
* In concurrent programming, we often require mechanisms for synchronizing access to shared resources.
196+
* Typically to solve such issues we use synchronization primitives like mutexes and condition variables.
197+
* As persistent memory offers bigger capacity than DRAM it may be useful to store synchronization primitives
198+
* on it. Unfortunately such approach may cause performance degradation due to frequent writes to a memory
199+
* with relatively higher latency (it's because taking a lock or signaling a conditional variable often
200+
* requires additional writes). Few extra words how locks can be used in libpmemobj-cpp can be found in
201+
* @ref transactions.
202+
*
203+
* It's worth noticing that pmem locks are automatically released on recovery or when crash happened.
204+
*
205+
* ## Additional resources
206+
* - [Libpmemobj-cpp - lessons learned](https://pmem.io/blog/2021/09/libpmemobj-cpp-lessons-learned)
207+
* In this blog post we explain, i.a., why keeping locks on pmem is not a good idea.
208+
*/
209+
195210
/** @defgroup primitives Primitives
196-
* Basic classes that provides PMEM-aware pointers and pool handlers.
211+
* Basic classes that provide PMEM-aware pointers and pool handlers.
197212
*
198213
* ## Pointers
199214
* There are few types to handle data on PMEM.
200215
* - @ref pmem::obj::persistent_ptr<T> - implements a smart pointer.
201216
* It encapsulates the [PMEMoid](https://pmem.io/2015/06/11/type-safety-macros.html) fat
202217
* pointer and provides member access, dereference and array access operators.
203218
* - @ref pmem::obj::experimental::self_relative_ptr<T> - implements a smart ptr.
204-
* It encapsulates the self offsetted pointer and provides member access, dereference and array access operators.
219+
* It encapsulates the self-offsetted pointer and provides member access, dereference and array access operators.
205220
* self_relative_ptr in comparison to persistent_ptr is:
206-
* - smaller size (8B vs 16B)
207-
* - can be used with atomic operations
208-
* - faster dereference (important in loop), also allows vectorization
209-
* - if stored in a persistent memory pool, it can only points to elements within the same pool
221+
* - smaller in size (8B vs 16B),
222+
* - can be used with atomic operations,
223+
* - dereferenced faster (it's important, e.g., in loops),
224+
* - allows vectorization,
225+
* - if stored in a persistent memory pool, it can only points to elements within the same pool.
210226
* - @ref pmem::obj::p<T> - template class that can be used for all variables (except persistent pointers),
211227
* which are used in @ref transactions.
212228
* This class is not designed to be used with compound types. For that see the @ref pmem::obj::persistent_ptr.
@@ -216,8 +232,8 @@
216232
* exactly once per instance of the application. This class has 8 bytes of storage overhead.
217233
*
218234
* ## Pool handles
219-
* Pool class provides basic operations on pmemobj [pools](https://pmem.io/2016/05/10/cpp-05.html). C++ API for pools should
220-
* not be mixed with C API. For example explicitly calling pmemobj_set_user_data(pop)
235+
* Pool class provides basic operations on pmemobj [pools](https://pmem.io/2016/05/10/cpp-05.html).
236+
* C++ API for pools should not be mixed with C API. For example explicitly calling `pmemobj_set_user_data(pop)`
221237
* on pool which is handled by C++ pool object is undefined behaviour.
222238
*
223239
* There are few pool handlers:
@@ -234,9 +250,10 @@
234250
* Possible exceptions that could be thrown by the libpmemobj++.
235251
*
236252
* In runtime, some operations may fail, then all you need is to catch the exception.
237-
* Every pmem exception has **std::runtime_error** in its inheritance tree
238-
* and contains proper message with an error description.
239-
* All exceptions can be caught using just **std::runtime_error**.
253+
* Every pmem exception has `std::runtime_error` in its inheritance tree, which means
254+
* that all exceptions can be caught using just this type. Each exception contains
255+
* proper message with an error description.
256+
*
240257
* Look at the list on this page to explore all exceptions with their descriptions.
241258
*
242259
* Transaction handles uncaught exceptions thrown inside its scope, then aborts
@@ -247,13 +264,13 @@
247264
* Let's consider following example:
248265
* @snippet examples/mpsc_queue/mpsc_queue.cpp mpsc_main
249266
*
250-
* There are plenty of try-catch blocks placed to handle possible errors that can happen in some conditions.
251-
* E.g. @ref pmem::obj::pool<T>::open can lead to @ref pmem::pool_error.
252-
* Next exception, **std::exception**, is placed to handle possible errors during allocation,
253-
* coming from @ref pmem::obj::make_persistent. Worth being careful using every new function
254-
* because some of exceptions are not obvious, e.g., pmem::obj::pool<T>::close
255-
* at the end of the code which may throw **std::logic_error**.
267+
* There are plenty of try-catch blocks placed to handle possible errors that can occur in some
268+
* conditions. E.g. @ref pmem::obj::pool<T>::open can lead to @ref pmem::pool_error.
269+
* The next exception, **std::exception**, is placed to handle possible errors during allocation,
270+
* coming from @ref pmem::obj::make_persistent. Worth being careful using any new function
271+
* because some exceptions are not obvious, e.g., pmem::obj::pool<T>::close
272+
* at the end of the code, which may throw **std::logic_error**.
256273
*
257-
* You should check every function you will use in context of possible
258-
* exceptions and then handle them to avoid crash.
259-
**/
274+
* You should check every function you will use in the context of possible
275+
* exceptions and then handle them to avoid a crash.
276+
*/

0 commit comments

Comments
 (0)