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

Commit 2083ad3

Browse files
authored
Merge pull request #1200 from lukaszstolarczuk/fix-misc-docs
docs: update miscellaneous Doxygen comments
2 parents c22738c + 5bbf9a0 commit 2083ad3

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

doc/groups_definitions.dox

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,37 @@
7171
*/
7272

7373
/** @defgroup transactions Transactions
74-
* This section introduces transaction feature in libpmemobj-cpp.
74+
* Transactional approach to store data on pmem.
7575
*
76-
* ## General info about transactions
76+
* # General info about transactions
77+
*
78+
* The heart of the libpmemobj are transactions. A transaction is defined as series of operations on
79+
* **persistent memory objects** that either all occur, or nothing occurs. In particular, if the execution
80+
* of a transaction is interrupted by a power failure or a system crash, it is guaranteed that after
81+
* system restart, all the changes made as a part of the uncompleted transaction will be rolled back,
82+
* restoring the consistent state of the memory pool from the moment when the transaction was started.
83+
*
84+
* @note Any operations not using libpmemobj-cpp API (like `int x = 5` or `malloc()`) used within
85+
* transaction will not be a part ot the transaction and won't be rolled back on failure! To properly
86+
* store variables on pmem use @ref primitives , to allocate data on pmem see @ref allocation functions.
87+
*
88+
* In C++ bindings (*this library*) transactions were designed (in comparison to C API)
89+
* to be as developer-friendly as possible. Even though libpmemobj++ are the bindings you should not
90+
* mix these two APIs - using libpmemobj (C API) in C++ application will not work!
7791
*
78-
* The heart of the libpmemobj are transactions, and they are designed to be developer-friendly.
7992
* Let's take a look at the following snippet:
8093
*
8194
* @snippet transaction/transaction.cpp general_tx_example
8295
*
83-
* Code snippet above is an example how automatic transaction can look like.
96+
* Code above is an example how automatic transaction can look like.
8497
* After object creation there are a few statements executed within a transaction.
85-
* Transaction will be committed during *tx* object's destruction at the end of scope.
98+
* Transaction will be committed during *tx* object's destruction at the end of the scope.
8699
*
87100
* It's worth noticing that @ref pmem::obj::flat_transaction is recommended to use over @ref pmem::obj::basic_transaction.
88101
* An extra explanation is provided inline an example in @ref pmem::obj::flat_transaction description.
89102
*
90103
* Mentioned above transactions are handled through two internal classes:
104+
*
91105
* - **manual** transactions has to be committed explicitly, otherwise it will abort.
92106
* All operations between creating and destroying the transaction
93107
* object are treated as performed in a transaction block and
@@ -97,6 +111,7 @@
97111
* they are already unlocked.
98112
* The best way to use manual transactions is by
99113
* @ref pmem::obj::transaction::run, which is used in example above.
114+
*
100115
* - **automatic** transactions are only available in C++17. All operations
101116
* between creating and destroying the transaction object are treated as
102117
* performed in a transaction block and can be rolled back.
@@ -109,7 +124,7 @@
109124
* If you want to read more and see example usages of both, you have to see
110125
* flat or basic transaction documentation, because each implementation may differ.
111126
*
112-
* ## Lifecycle and stages:
127+
* # Lifecycle and stages:
113128
*
114129
* When you are using transaction API a transaction can be in one of the following states:
115130
* - *TX_STAGE_NONE* - no open transaction in this thread
@@ -124,13 +139,12 @@
124139
*
125140
* ![lifecycle](https://pmem.io/assets/lifecycle.png "Transaction lifecycle")
126141
*
127-
* To be more familiar with functions used in diagram read:
128-
* [pmemobj_tx_begin manpage](https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_tx_begin.3.html),
129-
* this is a C API manpage for [libpmemobj](https://pmem.io/pmdk/libpmemobj/).
142+
* To be more familiar with functions used in diagram read e.g. **pmemobj_tx_begin**(3) manpage
143+
* (C API for [libpmemobj](https://pmem.io/pmdk/libpmemobj/), link below in *Additional resources*).
130144
*
131145
* If you need to read general information about transaction move to the *Additional resources* section.
132146
*
133-
* ## Example of flat_transaction
147+
* # Example of flat_transaction
134148
* For comparison with the previous snippet, here is a code snippet of
135149
* @ref pmem::obj::flat_transaction which is listed below with basic explanation inline.
136150
* @snippet transaction/transaction.cpp tx_nested_struct_example
@@ -139,7 +153,8 @@
139153
* For more examples please look at the
140154
* [examples directory](https://github.com/pmem/libpmemobj-cpp/tree/master/examples) in libpmemobj-cpp repository.
141155
*
142-
* ## Additional resources
156+
* # Additional resources
157+
* - [pmemobj_tx_begin(3) manpage with transaction description (C API)](https://pmem.io/pmdk/manpages/linux/master/libpmemobj/pmemobj_tx_begin.3)
143158
* - [blog post about transactions](https://pmem.io/2016/05/25/cpp-07.html)
144159
* - [blog post about transactional allocations](https://pmem.io/2016/05/19/cpp-06.html)
145160
*/

include/libpmemobj++/pool.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class persistent_ptr;
4444
* example would be:
4545
* @snippet pool/pool.cpp pool_base_example
4646
*
47-
* The exmple of using pool with RAII idiom:
47+
* The example of using pool with RAII idiom:
4848
* @snippet pool/pool_as_class_member.cpp pool_class_member_example
4949
* @ingroup primitives
5050
*/

include/libpmemobj++/string_view.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ basic_string_view<CharT, Traits>::crbegin() const noexcept
296296
}
297297

298298
/**
299-
* Returns an iterator to the first character of the view.
299+
* Returns a reverse_iterator to the first character of the view.
300300
* Reverse iterators iterate backwards: increasing
301301
* them moves them towards the beginning of the string.
302302
* This character acts as a placeholder, attempting to access it results
@@ -312,7 +312,7 @@ basic_string_view<CharT, Traits>::rend() const noexcept
312312
}
313313

314314
/**
315-
* Returns an iterator to the first character of the view.
315+
* Returns a reverse_iterator to the first character of the view.
316316
* Reverse iterators iterate backwards: increasing
317317
* them moves them towards the beginning of the string.
318318
* This character acts as a placeholder, attempting to access it results

0 commit comments

Comments
 (0)