From 2ee7c7f00e0d9895681b6a523e6f92eb93122095 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Wed, 30 Aug 2023 16:17:57 -0500 Subject: 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 Tested-by: Inwit Acked-by: Robin Jarry --- worker/notmuch/lib/database.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'worker/notmuch/lib') 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) { -- cgit