store: ensure updates update message sexp too

And turn all "add" into "replace" so old messages get removed.
Update tests too.
This commit is contained in:
Dirk-Jan C. Binnema
2022-05-05 01:27:08 +03:00
parent c0ae7e6860
commit 6126d7ee62
8 changed files with 329 additions and 170 deletions

View File

@ -67,6 +67,7 @@ public:
* @param maildir maildir to use for this store
* @param personal_addresses addresses that should be recognized as
* 'personal' for identifying personal messages.
* @param config a configuration object
*/
Store(const std::string& path,
const std::string& maildir,
@ -116,14 +117,6 @@ public:
*/
const Xapian::Database& database() const;
/**
* Get the underlying writable Xapian database for this
* store. Throws is this store is not writable.
*
* @return the writable database
*/
Xapian::WritableDatabase& writable_database();
/**
* Get the Indexer associated with this store. It is an error to call
* this on a read-only store.
@ -205,9 +198,9 @@ public:
* @param msg a message
* @param id the id for this message
*
* @return false in case of failure; true otherwise.
* @return Ok() or an error.
*/
bool update_message(Message& msg, Id id);
Result<Store::Id> update_message(Message& msg, Id id);
/**
* Remove a message from the store. It will _not_ remove the message
@ -384,6 +377,7 @@ public:
const std::unique_ptr<Private>& priv() const { return priv_; }
private:
std::unique_ptr<Private> priv_;
};