+ _begin_atomic = nmlib.notmuch_database_begin_atomic
+ _begin_atomic.argtypes = [NotmuchDatabaseP]
+ _begin_atomic.restype = c_uint
+
+ def begin_atomic(self):
+ """Begin an atomic database operation
+
+ Any modifications performed between a successful
+ :meth:`begin_atomic` and a :meth:`end_atomic` will be applied to
+ the database atomically. Note that, unlike a typical database
+ transaction, this only ensures atomicity, not durability;
+ neither begin nor end necessarily flush modifications to disk.
+
+ :returns: :attr:`STATUS`.SUCCESS or raises
+ :exception: :exc:`NotmuchError`: :attr:`STATUS`.XAPIAN_EXCEPTION
+ Xapian exception occurred; atomic section not entered.
+
+ *Added in notmuch 0.9*"""
+ self._assert_db_is_initialized()
+ status = self._begin_atomic(self._db)
+ if status != STATUS.SUCCESS:
+ raise NotmuchError(status)
+ return status
+
+ _end_atomic = nmlib.notmuch_database_end_atomic
+ _end_atomic.argtypes = [NotmuchDatabaseP]
+ _end_atomic.restype = c_uint
+
+ def end_atomic(self):
+ """Indicate the end of an atomic database operation
+
+ See :meth:`begin_atomic` for details.
+
+ :returns: :attr:`STATUS`.SUCCESS or raises
+
+ :exception:
+ :exc:`NotmuchError`:
+ :attr:`STATUS`.XAPIAN_EXCEPTION
+ A Xapian exception occurred; atomic section not
+ ended.
+ :attr:`STATUS`.UNBALANCED_ATOMIC:
+ end_atomic has been called more times than begin_atomic.
+
+ *Added in notmuch 0.9*"""
+ self._assert_db_is_initialized()
+ status = self._end_atomic(self._db)
+ if status != STATUS.SUCCESS:
+ raise NotmuchError(status)
+ return status
+