aboutsummaryrefslogtreecommitdiffstats
path: root/worker/notmuch/lib
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2023-08-30 16:17:57 -0500
committerRobin Jarry <robin@jarry.cc>2023-08-31 17:36:22 +0200
commit2ee7c7f00e0d9895681b6a523e6f92eb93122095 (patch)
tree4ff060fadd67f7e84b2dff462216d2d1e2430fc0 /worker/notmuch/lib
parent67807a6b9b05e55f772fa985aa2dd34bc2915599 (diff)
downloadaerc-2ee7c7f00e0d9895681b6a523e6f92eb93122095.tar.gz
notmuch: track database state
Track the notmuch database state. When a state change is detected, query if any changes affect the current query then send updates accordingly. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/notmuch/lib')
-rw-r--r--worker/notmuch/lib/database.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/worker/notmuch/lib/database.go b/worker/notmuch/lib/database.go
index 501f39de..3b9de011 100644
--- a/worker/notmuch/lib/database.go
+++ b/worker/notmuch/lib/database.go
@@ -52,6 +52,13 @@ func (db *DB) ListTags() []string {
return db.db.Tags()
}
+// State returns the lastmod of the database. This is a uin64 which is
+// incremented with every modification
+func (db *DB) State() uint64 {
+ _, lastmod := db.db.Revision()
+ return lastmod
+}
+
// getQuery returns a query based on the provided query string.
// It also configures the query as specified on the worker
func (db *DB) newQuery(query string) (*notmuch.Query, error) {