database: Store directory paths as relative, not absolute.

We were already storing relative mail filenames, so this is consistent
with that. Additionally, it means that directory documents remain
valid even if the database is relocated within its containing
filesystem.
This commit is contained in:
Carl Worth 2009-12-19 13:11:00 -08:00
parent 9257622da8
commit 154bf7ac67
2 changed files with 8 additions and 1 deletions

View file

@ -86,7 +86,7 @@ typedef struct {
* *
* The directory document is indexed with a single prefixed term: * The directory document is indexed with a single prefixed term:
* *
* directory: The directory path (an absolute path) * directory: The directory path (relative to the database path)
* *
* and has a single value: * and has a single value:
* *
@ -639,6 +639,8 @@ notmuch_database_set_directory_mtime (notmuch_database_t *notmuch,
return NOTMUCH_STATUS_READONLY_DATABASE; return NOTMUCH_STATUS_READONLY_DATABASE;
} }
path = _notmuch_database_relative_path (notmuch, path);
db = static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db); db = static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db);
db_path = directory_db_path (path); db_path = directory_db_path (path);

View file

@ -179,6 +179,11 @@ const char *
notmuch_database_get_path (notmuch_database_t *database); notmuch_database_get_path (notmuch_database_t *database);
/* Store an mtime within the database for 'path'. /* Store an mtime within the database for 'path'.
*
* Here,'path' should be the path of a directory relative to the path
* of 'database' (see notmuch_database_get_path), or else should be an
* absolute path with initial components that match the path of
* 'database'.
* *
* The intention is for the caller to use the mtime to allow efficient * The intention is for the caller to use the mtime to allow efficient
* identification of new messages to be added to the database. The * identification of new messages to be added to the database. The