unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: Reto <reto@labrat.space>, notmuch@notmuchmail.org
Subject: Re: export notmuch_database_reopen
Date: Thu, 20 Feb 2020 16:36:07 -0500	[thread overview]
Message-ID: <875zg19c1k.fsf@fifthhorseman.net> (raw)
In-Reply-To: <95638E1C-E025-4863-9F6C-DAF7F8CD4B1A@labrat.space>

[-- Attachment #1: Type: text/plain, Size: 1752 bytes --]

On Thu 2020-02-20 19:16:23 +0100, Reto wrote:
> On 20 February 2020 18:18:52 CET, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
>>if you have a read/write DB, then the changes you make to the DB are
>>also visible, right?  it's not a static snapshot in that sense.
>
> Ehm, not the behavior I've seen while I was testing it out, but that may have been my fault then?

Just to confirm/clarify:

If i run the following python3 code against a database with your message
in it:

```
import notmuch2
db = notmuch2.Database(mode=notmuch2.Database.MODE.READ_WRITE)
print("before:")
for m in db.messages('tag:testing123'):
    print(m.messageid)
db.find('95638E1C-E025-4863-9F6C-DAF7F8CD4B1A@labrat.space').tags.add('testing123')
print("after:")
for m in db.messages('tag:testing123'):
    print(m.messageid)
db.find('95638E1C-E025-4863-9F6C-DAF7F8CD4B1A@labrat.space').tags.remove('testing123')
```

It prints:

```
before:
after:
95638E1C-E025-4863-9F6C-DAF7F8CD4B1A@labrat.space
```

The fact that "before:" shows nothing, and "after:" shows that the
message ID was tagged suggests to me that changes i make to a r/w
database object *are* reflected in subsequent queries to the same
database object.

Anyway, i agree that it'd be nice to be able to refresh a read-only
database object with a new view of the db if the underlying db has
changed.  However, i wonder what happens to any existing message objects
that are hanging off of the database object at the time that the
database gets reopened.  Should all of those objects all be refreshed as
well?

For example, consider a message object that you can use to enumerate
tags.  When the associated database is reopened, should the enumerated
list of tags change for that message object?

      --dkg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

      reply	other threads:[~2020-02-21  2:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13 21:11 export notmuch_database_reopen Reto
2020-02-13 22:54 ` David Bremner
2020-02-14  5:07   ` Reto
2020-02-20 17:18 ` Daniel Kahn Gillmor
2020-02-20 18:16   ` Reto
2020-02-20 21:36     ` Daniel Kahn Gillmor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zg19c1k.fsf@fifthhorseman.net \
    --to=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    --cc=reto@labrat.space \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).