aboutsummaryrefslogtreecommitdiff
path: root/bindings/python
diff options
context:
space:
mode:
authorGaute Hope <eg@gaute.vetsj.com>2017-03-06 17:37:34 +0100
committerDavid Bremner <david@tethera.net>2017-03-09 10:20:50 -0400
commita39a1ee1529bfa3c88ecd6c9a10269f340ebf05f (patch)
tree8e8ba797c539d1f4e6f1404f28662d552bd12313 /bindings/python
parentb7763c94e23bbb7d27e995e7a721f31b2ba8cb13 (diff)
bindings/python: add bindings for notmuch_database_get_revision
Database.get_revision () returns a tuple with the current database revision and the UUID string representing the database.
Diffstat (limited to 'bindings/python')
-rw-r--r--bindings/python/notmuch/database.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index 67fb1c41..8f918069 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -86,6 +86,11 @@ class Database(object):
_get_version.argtypes = [NotmuchDatabaseP]
_get_version.restype = c_uint
+ """notmuch_database_get_revision"""
+ _get_revision = nmlib.notmuch_database_get_revision
+ _get_revision.argtypes = [NotmuchDatabaseP, POINTER(c_char_p)]
+ _get_revision.restype = c_uint
+
"""notmuch_database_open"""
_open = nmlib.notmuch_database_open
_open.argtypes = [c_char_p, c_uint, POINTER(NotmuchDatabaseP)]
@@ -261,6 +266,17 @@ class Database(object):
self._assert_db_is_initialized()
return Database._get_version(self._db)
+ def get_revision (self):
+ """Returns the committed database revison and UUID
+
+ :returns: (revison, uuid) The database revision as a positive integer
+ and the UUID of the database.
+ """
+ self._assert_db_is_initialized()
+ uuid = c_char_p ()
+ revision = Database._get_revision(self._db, byref (uuid))
+ return (revision, uuid.value.decode ('utf-8'))
+
_needs_upgrade = nmlib.notmuch_database_needs_upgrade
_needs_upgrade.argtypes = [NotmuchDatabaseP]
_needs_upgrade.restype = bool