summaryrefslogtreecommitdiff
path: root/lib/mu-store.hh
AgeCommit message (Collapse)Author
2026-02-24mu-store: cosmeticsDirk-Jan C. Binnema
2026-02-16New incremental cleanup strategy: 63%-88% fasterDaniel Colascione
This change adds a new cleanup mode that avoids cleanup having re-traverse the directories the index pass just looked at. Additionally, we efficiently query the Xapian database by walking the term list instead of doing multiple point-wise path lookups. I'd noticed that most of my time in mu's cleanup pass consisted of B-tree lookups in Xapian (one 8KB pread64 at a time). The point lookups forced Xapian to traverse from the root of the B-tree to the leaf for every single message. Additionally, in order to join on the message path, we had to do *another* B-tree traversal after locating each message term. Now we just walk the terms in order, which is much more efficient, as we touch each B-tree node only once. On my system, with 1371861 total messages, the total time of mu index (no lazy check): --nocleanup: 3.6s incremental cleanup: 4.2s (0.6s in cleanup) legacy cleanup: 5.2s (1.6s in cleanup) With the new mode, we save 1.0s of the 1.6s cleanup, so we're ~63% faster. But the incremental cleanup works even better with lazy checking. If I enable --lazy-check, dirty only my INBOX (360778 messages), and run index, I get: --nocleanup: 0.9s incremental cleanup: 1.1s (0.2s in cleanup) legacy cleanup: 2.5s (1.6s in cleanup) We save 1.4s out of 1.6s for ~88% speedup. This change also fixes a timestamp bug: we should be storing the *start* time of the index pass in metadata, not the end time, so that on the next index pass, we notice messages that arrived between the two times. All tests pass. You can set the environment variable MU_NO_INCREMENTAL_CLEANUP to use the legacy cleanup path instead.
2025-09-03store: remove some _unlocked functions, update clear_labelsDirk-Jan C. Binnema
They don't add much value, let's remove. Rework clear_labels in terms of update_labels.
2025-09-02mu: refactor labels codeDirk-Jan C. Binnema
Split labels-cache and store-labels.
2025-09-02labels: allow restoring cache-mapDirk-Jan C. Binnema
E.g. with unexpected termination for mu it is possible that the labels-cache (i.e., the one that is used for auto-completion) gets disconnected from reality. Add a --restore option to `mu label list` to restore the actual labels from the labels seen in the store.
2025-09-01store: implement serialize method, use itDirk-Jan C. Binnema
For triggering saving the contacts / labels caches.
2025-08-31store: improve label handlingDirk-Jan C. Binnema
In particular, clear_labels And some cosmetics
2025-08-31server: add label handlerDirk-Jan C. Binnema
For handling mu4e label update requests.
2025-08-16labels: refactor import/export to mu-store-labelsDirk-Jan C. Binnema
Move the import/export code to 'lib'.
2025-08-15store: add support for modifying and listing labels and cachingDirk-Jan C. Binnema
Add methods update_labels, clear_labels which update or clear the labels for a message in the store, and update the cache with the overall counts of labels. Add a LabelsCache to keep track of the counts and labels_map() to retrieve that map.
2025-05-24message: retain non-file flags when movingDirk-Jan C. Binnema
The content-flags won't change, and the unread-flag can be re-calculated. Add a unit test, and some small doc improvements. Fixes #2831.
2024-11-26lib/store-worker: removeDirk-Jan C. Binnema
We're not using it.
2024-06-03store-worker: implementDirk-Jan C. Binnema
store-worker is a thread + async queue to throttle requests to a single thread.
2024-05-08mu-store/indexer: consume messages from workersDirk-Jan C. Binnema
Add store::consume_message, which is like add message but std::move from the caller such that the messages longer has copies (with Xapian::Document) on the caller side; this is to avoid threading issues.
2024-05-01lib: centralize xapian include, enable move semanticsDirk-Jan C. Binnema
Only include xapian.h in one place, so we can have consistent options. With that in place, we can enable C++ move semantics. We don't do anything with that yet, but we check in the meson.build file to see if we have the required xapian version.
2024-02-26mu-init: insist that --maildir is absoluteDirk-Jan C. Binnema
2023-12-22lib: move transaction handling to mu-xapianDirk-Jan C. Binnema
Instead of handling transactions in the store, handle it in xapian-db. Make the code a bit more natural / cleaner-out Handle transaction automatically (with a batch-size) and add some RAII Transaction object, which makes all database interaction transactable for the duration. So, no more need for explicit parameters to add_message while indexing.
2023-09-24store: better handling moving messagesDirk-Jan C. Binnema
sort results (for testing) with the ChangeName flag, also apply to dup messages.
2023-09-24mu-move: add new move sub commandDirk-Jan C. Binnema
Add sub-command to move messages; add tests and docs. Fixes #157
2023-09-13lib: unit tests: improve / better coverageDirk-Jan C. Binnema
2023-09-10lib: move index/ into main lib/Dirk-Jan C. Binnema
simplify things a bit
2023-09-09lib: improve printability for some typesDirk-Jan C. Binnema
A little fmt pixie dust
2023-09-09support xapian ngramsDirk-Jan C. Binnema
Xapian supports an "ngrams" option to help with languages/scripts without explicit wordbreaks, such as Chinese / Japanese / Korean. Add some plumbing for supporting this in mu as well. Experimental for now.
2023-08-17store: expose maildirs() methodDirk-Jan C. Binnema
This gets the current list of maildirs by asking the scanner to do a file-system search.
2023-08-17store: update "move" and some related APIsDirk-Jan C. Binnema
Update test cases as well.
2023-07-25store: add 'add_document' optimization, use itDirk-Jan C. Binnema
*Usually* we need Xapian's replace_document() API, but when we know a document (message) is completely new, we can use the faster add_document(). That is the case with the initial (re)indexing, when start with an empty database. Also a few smaller cleanups.
2023-07-23lib: improve store error messagesDirk-Jan C. Binnema
Use xapian_try_result
2023-07-10store/server: centralize docids-for-msgidDirk-Jan C. Binnema
No need for two near-identical impls Remove some dead declarations.
2023-07-02lib/store: rework to use xapian-db / configDirk-Jan C. Binnema
Simplifies the implementation.
2023-04-23store: small cleanupsDirk-Jan C. Binnema
Remove readonly/inmemory from properties. Add read_only() accessor.
2022-12-07store: update move_message APIDirk-Jan C. Binnema
Update the move_message API so to allow for updating duplicate messages too (not implemented yet), and return all updated messages.
2022-10-02store: support reinitDirk-Jan C. Binnema
Support reinitializing, based on some current store. This is useful for upgrading. Note that this is only the backend implementation + tests.
2022-06-09store: fix typoDirk-Jan C. Binnema
2022-06-02lib: improve test coverageDirk-Jan C. Binnema
Add a bunch of tests
2022-05-18indexer/store: avoid completed callbackDirk-Jan C. Binnema
This cause havoc / race conditions.
2022-05-10store/info: Gather some usage statisticsDirk-Jan C. Binnema
Keep track of the latest-change/latest-index.
2022-05-09store: use Result<Store> builder, add auto upgradeDirk-Jan C. Binnema
Make it a Result type, and add auto-upgrade (not enabled yet) Update dependents.
2022-05-09store/fields: Use one MaxTermLength everywhereDirk-Jan C. Binnema
One should be enough!
2022-05-05store: ensure updates update message sexp tooDirk-Jan C. Binnema
And turn all "add" into "replace" so old messages get removed. Update tests too.
2022-05-05message/field: cache the message's sexpDirk-Jan C. Binnema
Keep it in the store; much faster than generating on the fly.
2022-04-30store: update to use Message; big cleanupDirk-Jan C. Binnema
Remove much of the message processing from the store
2022-04-30lib: update Store & QueryResults in terms of Mu::MessageDirk-Jan C. Binnema
2022-03-28lib+guile: use Mu::Option, not std::optionalDirk-Jan C. Binnema
We need the extensions, and/or let's use _one_ optional implementation everywhere.
2022-03-26store: cosmeticsDirk-Jan C. Binnema
2022-03-26many: update for lib/message updatesDirk-Jan C. Binnema
Adapt to the new names / directory. Big commit, but mostly just very boring renaming.
2022-03-14store::for_each_term: use field-idDirk-Jan C. Binnema
We were trying to convert a field (string) to a xapian prefix back to a field (enum). That's unnecessarily complicated and worse, step 2 won't work.
2022-03-07lib/store: use mu-message-fieldsDirk-Jan C. Binnema
2022-02-21lib: rename contacts into contacts-cacheDirk-Jan C. Binnema
Plus dependents.
2022-02-17store: expose the mutex so we can lock query-resultsDirk-Jan C. Binnema
The QueryResults must not outlive the lock (when in a MT context), so expose for clients (mu-server) to handle it.
2022-02-14store: expose metadata()/set_metadata()Dirk-Jan C. Binnema
Allow for storing metadata in the database, and consider the cache.