[PATCH 2/3] Produce status messages during compacting

Ben Gamari bgamari.foss at gmail.com
Mon Aug 20 08:31:43 PDT 2012


---
 lib/database.cc |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib/database.cc b/lib/database.cc
index 6e83a61..49aa36d 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -780,11 +780,24 @@ notmuch_database_close (notmuch_database_t *notmuch)
     notmuch->value_range_processor = NULL;
 }
 
+class NotmuchCompactor : public Xapian::Compactor
+{
+public:
+    virtual void
+    set_status (const std::string &table, const std::string &status)
+    {
+	if (status.length() == 0)
+	    fprintf (stderr, "compacting table %s:\n", table.c_str());
+	else
+	    fprintf (stderr, "     %s\n", status.c_str());
+    }
+};
+
 void
 notmuch_database_close_compact (notmuch_database_t *notmuch)
 {
     void *local = talloc_new (NULL);
-    Xapian::Compactor compactor;
+    NotmuchCompactor compactor;
     char *notmuch_path, *xapian_path, *compact_xapian_path, *old_xapian_path;
 
 #if HAVE_XAPIAN_COMPACT
-- 
1.7.9.5



More information about the notmuch mailing list