Commit Graph

68 Commits

Author SHA1 Message Date
Dirk-Jan C. Binnema 7822d2633e update contacts-cache users for MessageContact
Since contacts-cache now uses MessageContact, update its users
2022-02-21 23:51:46 +02:00
Dirk-Jan C. Binnema a82bd77d09 lib: rename contacts into contacts-cache
Plus dependents.
2022-02-21 23:22:42 +02:00
Dirk-Jan C. Binnema 39c45abc38 mu-store: use Mu::MessageContact
Use the new contact class. And a lot of whitespace cleanups.
2022-02-21 23:22:42 +02:00
Dirk-Jan C. Binnema 8cea933a51 mu-store: take mu_util_get_hash
mu-store is the only user left, move the implementation there.
2022-02-19 19:09:25 +02:00
Dirk-Jan C. Binnema c0da564bba lib: fix clang compatibility / warnings 2022-02-18 10:49:56 +02:00
Dirk-Jan C. Binnema 831d26052a store: expose the mutex so we can lock query-results
The QueryResults must not outlive the lock (when in a MT context), so expose for
clients (mu-server) to handle it.
2022-02-17 23:49:17 +02:00
Dirk-Jan C. Binnema f6f17d5d6b *: update code for Mu::MessageFlags
Migrate the code to use the new niceness
2022-02-17 23:48:59 +02:00
Dirk-Jan C. Binnema 3086238b33 store: expose metadata()/set_metadata()
Allow for storing metadata in the database, and consider the cache.
2022-02-14 11:12:26 +02:00
Dirk-Jan C. Binnema 3820118246 store: rename "metadata" into "properties"
properties are the constant (for the duration) values for a store; metadata may
change, so reserve that name for that.
2022-02-14 11:12:26 +02:00
Dirk-Jan C. Binnema 23fc8bdba8 update code for Mu::MessagePriority
Update dependent code
2022-02-14 11:12:26 +02:00
Dirk-Jan C. Binnema 43c44cf6cd store: catch dtor exception 2022-02-07 22:34:49 +02:00
Dirk-Jan C. Binnema 77bca5463f store: don't lock for_each_term
It's only called from the parser with a store, and when we _already_
hold the lock.
2022-02-05 08:44:43 +02:00
Dirk-Jan C. Binnema 05393ba797 index: save/commit metadata after messages
Ensure the metadata (dirstamps) for messages are only written / committed _after_
the accompanying message have been written / committed.

This avoids missing updates when indexing gets terminated unexpectedly.
2022-02-03 23:04:18 +02:00
Dirk-Jan C. Binnema 5fc8a8f83e store/query: access query only through store
Make Mu::Query only accessible through store, so we can lock the db for the
duration of a (full, multipass) query.
2022-01-30 14:52:41 +02:00
Dirk-Jan C. Binnema f035c801bb store: save contacts more often
Use the new Contacts::dirty() so serialize/save the contacts whenever we commit
a transaction.

And some cosmetics.
2022-01-15 15:12:38 +02:00
Dirk-Jan C. Binnema 4f02702510 store: add catch blocks for dirstamp/set_dirstamp 2021-12-18 15:22:52 +02:00
Dirk-Jan C. Binnema 4c0d8572d8 store/indexer: move transaction handling to store
Move the transaction handling code inside Store, simplifying the indexer.
2021-11-09 22:43:11 +02:00
Dirk-Jan C. Binnema 8028f88a51 mu: rework xapian dependencies a bit
Reduce the places where we need to include Xapian, and add a few places where
the (meson build) didn't explicitly have a Xapian dep where needed.
2021-11-03 12:34:08 +02:00
Dirk-Jan C. Binnema 89014ecd06 index/store: simplify transaction handling
only have transactions for indexing, and make it opportunistic. All other ops do
not use transactions.
2021-10-20 20:14:25 +03:00
Dirk-Jan C. Binnema 3dd721d5a3 clang-format: update c/cc coding style
Update all cc code using .clang-format; please do so as well for future PRs
etc.; emacs has a handy 'clang-format' mode to make this automatic.

For comparing old changes with git blame, we can disregard this one using
--ignore-rev

(see https://www.moxio.com/blog/43/ignoring-bulk-change-commits-with-git-blame )
2021-10-20 12:26:16 +03:00
Dirk-Jan C. Binnema 49637dbc3a lib: replace CATCH_BLOCK macros with template magic 2021-10-18 21:52:37 +03:00
Dirk-Jan C. Binnema 672d0c7238 store: don't try to commit when there's no transaction
Avoids some error warning.
2021-10-16 11:15:19 +03:00
Dirk-Jan C. Binnema 78ef8ddcbb mu-store: fix warning schema mismatch message
Fixes: #2069.
2021-07-31 17:54:33 +03:00
Dirk-Jan C. Binnema fd9cc6bcc4 mu-store: improve database schema error
Tell user they should mu-init
2021-07-31 01:47:21 +03:00
Dirk-Jan C. Binnema 34fae2c072 mu-store: update whitespace 2021-07-31 01:45:22 +03:00
Derek Zhou dc6f76d74d seperate Mu::format and Mu::vformat 2021-04-22 18:32:38 +00:00
Dirk-Jan C. Binnema 98abcf8e84 store: support in-memory database
For testing, this is faster / and doesn't pollute the file system.
2021-02-16 19:32:15 +02:00
Dirk-Jan C. Binnema a3c6e74869 lib: replace some #define with constexpr
minor cleanup.
2021-02-11 18:54:25 +02:00
Dirk-Jan C. Binnema 98744c66f7 remove some dead code 2021-01-22 23:24:53 +02:00
Dirk-Jan C. Binnema e282d80bc0 lib: Update for new querying machinery
Port to c++ and use new APIs.
2021-01-22 22:51:33 +02:00
Dirk-Jan C. Binnema ed4a640c39 lib/query: refactor & rework
- Move the lib/query/ stuff up a level into lib/
- Associate directly with the Query object
- Rework the Query object to be C++ rather than mixed with C
- Update all dependencies, tests
2020-11-04 23:35:30 +02:00
Dirk-Jan C. Binnema 2eb8fc82ad lib: fix 'personal' handling in contacts 2020-10-18 11:58:32 +03:00
Dirk-Jan C. Binnema dbff5671dd lib: support 'personal' regexp, move to mu-contacts
Move the determination of "personal" to MuContacts; add support for
regexps (POSIX-basic, in //)
2020-10-17 10:36:25 +03:00
Dirk-Jan C. Binnema 4617935d80 store: Update for the new indexer
Update some APIs so we can use it with the new indexer.

Remove some now-obsolete C APIs.
2020-06-27 17:07:00 +03:00
Dirk-Jan C. Binnema 981c781425 store: add bit more debug-logging 2020-06-13 16:56:41 +03:00
Dirk-Jan C. Binnema fe6582c6d6 lib: implement mu_store_update 2020-06-13 16:56:41 +03:00
Dirk-Jan C. Binnema a9fab4abcc mu: convert command-line tools to c++ 2020-06-13 16:56:41 +03:00
Kristian Rietveld c3032bd672 mu-store: enlarge buffer for strftime
On Debian 9 random memory was printed with the original buffer size
and valgrind complained about the use of uninitialized memory.
2020-05-01 20:47:45 +02:00
Dirk-Jan C. Binnema 49883806f6 store: remove unused code, use batchsize 2020-03-02 23:19:34 +02:00
damon-kwok 56b434347e error fix for gcc 9.x 2020-02-29 20:40:22 +08:00
Dirk-Jan C. Binnema 650c4c052d store: catch exceptions in dtor 2020-02-21 19:29:27 +02:00
Dirk-Jan C. Binnema c4c56fa7f0 mu-store: auto-commit store in dtor 2020-02-17 22:29:44 +02:00
Dirk-Jan C. Binnema f50360f94e mu-store: implement Store::find_message 2020-02-10 01:00:42 +02:00
Dirk-Jan C. Binnema aa10da0a63 store: rework to allow for 'init'
Rework the error handling / exception for read-only / writable and new
database.
2020-02-08 14:28:55 +02:00
Dirk-Jan C. Binnema f51846eefc mu: implement init, info commands
'init' is for the inital database setup

'info' is for gettting information about the mu database.
2020-02-08 14:28:55 +02:00
Dirk-Jan C. Binnema 2575b2d0e3 mu: better error handling for opening database read-only
Be a bit clearer for the user.
2020-02-04 21:14:30 +02:00
Dirk-Jan C. Binnema 38779cfade mu: no need to pass 'maildir' when we can deduce it
Only needed when setting up the database.
2020-02-04 01:05:35 +02:00
Dirk-Jan C. Binnema e51240f43f mu: lib: update store API. update some dependents
Implement add_message / remove_message.

Rename path_tstamp ->  dirstamp.

Rename maildir -> root_maildir

Update dependents.
2020-01-31 00:20:34 +02:00
Dirk-Jan C. Binnema a3d71dab91 utils: Update error exception, utils. 2020-01-18 13:40:15 +02:00
Dirk-Jan C. Binnema b2014fe93e use g_snprintf instead of snprintf
Seems the latter cannot be found on some platforms; perhaps a
c++/namespace thing?

Use g_snprintf instead.
2020-01-07 23:17:15 +02:00