[PATCH 2/2] Add notmuch_database_reopen method

2012-10-18 Thread Adrien Bustany
Calling notmuch_database_reopen is needed to refresh the database
contents when the database on disk was modified by another
notmuch_database_t instance, for example in a different thread.
---
 lib/database.cc | 17 +
 lib/notmuch.h   |  8 
 2 files changed, 25 insertions(+)

diff --git a/lib/database.cc b/lib/database.cc
index 1b680ab..f27d57f 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -763,6 +763,23 @@ notmuch_database_flush(notmuch_database_t *notmuch)
 return status;
 }

+notmuch_status_t
+notmuch_database_reopen(notmuch_database_t *notmuch)
+{
+notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
+
+try {
+   if (notmuch->xapian_db != NULL)
+   (notmuch->xapian_db)->reopen ();
+} catch (const Xapian::Error ) {
+   fprintf(stderr, "A Xapian exception occured reopening the database: 
%s\n",
+   error.get_msg().c_str());
+   status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+}
+
+return status;
+}
+
 void
 notmuch_database_close (notmuch_database_t *notmuch)
 {
diff --git a/lib/notmuch.h b/lib/notmuch.h
index aef5c56..51d6a9a 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -205,6 +205,14 @@ notmuch_database_open (const char *path,
 notmuch_status_t
 notmuch_database_flush (notmuch_database_t *database);

+/* Refresh the database contents to the latest version.
+ *
+ * This is needed only if another instance of notmuch_database_t has
+ * modified the database contents on disk.
+ */
+notmuch_status_t
+notmuch_database_reopen (notmuch_database_t *database);
+
 /* Close the given notmuch database.
  *
  * After notmuch_database_close has been called, calls to other
-- 
1.7.11.7



[PATCH 2/2] Add notmuch_database_reopen method

2012-10-17 Thread Adrien Bustany
Calling notmuch_database_reopen is needed to refresh the database
contents when the database on disk was modified by another
notmuch_database_t instance, for example in a different thread.
---
 lib/database.cc | 17 +
 lib/notmuch.h   |  8 
 2 files changed, 25 insertions(+)

diff --git a/lib/database.cc b/lib/database.cc
index 1b680ab..f27d57f 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -763,6 +763,23 @@ notmuch_database_flush(notmuch_database_t *notmuch)
 return status;
 }
 
+notmuch_status_t
+notmuch_database_reopen(notmuch_database_t *notmuch)
+{
+notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
+
+try {
+   if (notmuch-xapian_db != NULL)
+   (notmuch-xapian_db)-reopen ();
+} catch (const Xapian::Error error) {
+   fprintf(stderr, A Xapian exception occured reopening the database: 
%s\n,
+   error.get_msg().c_str());
+   status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+}
+
+return status;
+}
+
 void
 notmuch_database_close (notmuch_database_t *notmuch)
 {
diff --git a/lib/notmuch.h b/lib/notmuch.h
index aef5c56..51d6a9a 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -205,6 +205,14 @@ notmuch_database_open (const char *path,
 notmuch_status_t
 notmuch_database_flush (notmuch_database_t *database);
 
+/* Refresh the database contents to the latest version.
+ *
+ * This is needed only if another instance of notmuch_database_t has
+ * modified the database contents on disk.
+ */
+notmuch_status_t
+notmuch_database_reopen (notmuch_database_t *database);
+
 /* Close the given notmuch database.
  *
  * After notmuch_database_close has been called, calls to other
-- 
1.7.11.7

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 2/2] Add notmuch_database_reopen method

2012-07-19 Thread Adrien Bustany
Calling notmuch_database_reopen is needed to refresh the database
contents when the database on disk was modified by another
notmuch_database_t instance, for example in a different thread.
---
 lib/database.cc |   17 +
 lib/notmuch.h   |8 
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index 55bcd17..3be5a30 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -763,6 +763,23 @@ notmuch_database_flush(notmuch_database_t *notmuch)
return status;
 }

+notmuch_status_t
+notmuch_database_reopen(notmuch_database_t *notmuch)
+{
+   notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
+
+   try {
+   if (notmuch->xapian_db != NULL)
+   (notmuch->xapian_db)->reopen ();
+   } catch (const Xapian::Error ) {
+   fprintf(stderr, "A Xapian exception occured reopening the database: 
%s\n",
+   error.get_msg().c_str());
+   status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+   }
+
+   return status;
+}
+
 void
 notmuch_database_close (notmuch_database_t *notmuch)
 {
diff --git a/lib/notmuch.h b/lib/notmuch.h
index aef5c56..51d6a9a 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -205,6 +205,14 @@ notmuch_database_open (const char *path,
 notmuch_status_t
 notmuch_database_flush (notmuch_database_t *database);

+/* Refresh the database contents to the latest version.
+ *
+ * This is needed only if another instance of notmuch_database_t has
+ * modified the database contents on disk.
+ */
+notmuch_status_t
+notmuch_database_reopen (notmuch_database_t *database);
+
 /* Close the given notmuch database.
  *
  * After notmuch_database_close has been called, calls to other
-- 
1.7.7.6



[PATCH 2/2] Add notmuch_database_reopen method

2012-07-19 Thread Adrien Bustany
Calling notmuch_database_reopen is needed to refresh the database
contents when the database on disk was modified by another
notmuch_database_t instance, for example in a different thread.
---
 lib/database.cc |   17 +
 lib/notmuch.h   |8 
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index 55bcd17..3be5a30 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -763,6 +763,23 @@ notmuch_database_flush(notmuch_database_t *notmuch)
return status;
 }
 
+notmuch_status_t
+notmuch_database_reopen(notmuch_database_t *notmuch)
+{
+   notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
+
+   try {
+   if (notmuch-xapian_db != NULL)
+   (notmuch-xapian_db)-reopen ();
+   } catch (const Xapian::Error error) {
+   fprintf(stderr, A Xapian exception occured reopening the database: 
%s\n,
+   error.get_msg().c_str());
+   status = NOTMUCH_STATUS_XAPIAN_EXCEPTION;
+   }
+
+   return status;
+}
+
 void
 notmuch_database_close (notmuch_database_t *notmuch)
 {
diff --git a/lib/notmuch.h b/lib/notmuch.h
index aef5c56..51d6a9a 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -205,6 +205,14 @@ notmuch_database_open (const char *path,
 notmuch_status_t
 notmuch_database_flush (notmuch_database_t *database);
 
+/* Refresh the database contents to the latest version.
+ *
+ * This is needed only if another instance of notmuch_database_t has
+ * modified the database contents on disk.
+ */
+notmuch_status_t
+notmuch_database_reopen (notmuch_database_t *database);
+
 /* Close the given notmuch database.
  *
  * After notmuch_database_close has been called, calls to other
-- 
1.7.7.6

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch