From 909f52bd8c4bdfa11cd3e75e3d0959e0293689bd Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 7 Jan 2010 18:26:31 -0800 Subject: lib: Implement versioning in the database and provide upgrade function. The recent support for renames in the database is our first time (since notmuch has had more than a single user) that we have a database format change. To support smooth upgrades we now encode a database format version number in the Xapian metadata. Going forward notmuch will emit a warning if used to read from a database with a newer version than it natively supports, and will refuse to write to a database with a newer version. The library also provides functions to query the database format version: notmuch_database_get_version to ask if notmuch wants a newer version than that: notmuch_database_needs_upgrade and a function to actually perform that upgrade: notmuch_database_upgrade --- lib/database-private.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/database-private.h') diff --git a/lib/database-private.h b/lib/database-private.h index 643b0507..5891584e 100644 --- a/lib/database-private.h +++ b/lib/database-private.h @@ -33,6 +33,8 @@ struct _notmuch_database { Xapian::QueryParser *query_parser; Xapian::TermGenerator *term_gen; Xapian::ValueRangeProcessor *value_range_processor; + + notmuch_bool_t needs_upgrade; }; /* Convert tags from Xapian internal format to notmuch format. -- cgit v1.2.3