1 Return-Path: <stebalien@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id 7031A6DE103A
\r
6 for <notmuch@notmuchmail.org>; Sun, 8 Nov 2015 11:16:09 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.637 tagged_above=-999 required=5 tests=[AWL=0.044,
\r
12 DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,
\r
13 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001,
\r
14 T_FREEMAIL_FORGED_FROMDOMAIN=0.01, T_HEADER_FROM_DIFFERENT_DOMAINS=0.01]
\r
16 Received: from arlo.cworth.org ([127.0.0.1])
\r
17 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
18 with ESMTP id kCIJmRHd6Dck for <notmuch@notmuchmail.org>;
\r
19 Sun, 8 Nov 2015 11:16:03 -0800 (PST)
\r
20 Received: from mail-qg0-f49.google.com (mail-qg0-f49.google.com
\r
22 by arlo.cworth.org (Postfix) with ESMTPS id 933AA6DE1034
\r
23 for <notmuch@notmuchmail.org>; Sun, 8 Nov 2015 11:16:03 -0800 (PST)
\r
24 Received: by qgeb1 with SMTP id b1so75177603qge.1
\r
25 for <notmuch@notmuchmail.org>; Sun, 08 Nov 2015 11:15:59 -0800 (PST)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=sender:date:from:to:cc:subject:message-id:references:mime-version
\r
28 :content-type:content-disposition:in-reply-to:phone:user-agent;
\r
29 bh=n8yB1vz70OTBpkFFUYAZlp1P4WxZZOYRwhoMSQfeRtY=;
\r
30 b=DkftCSqDotLGkdcXvDfesqfdAR2zQzdoqdMU4/vx1Ynau5zf43fRQdKFpuSfhK2doJ
\r
31 iG8tKDcnDE55Iuh6Sn9I01VEfK7pKdS0GG3LwtcFQS6bQjgOtZthGhZdm6MM4ajGvSOE
\r
32 GgAddZMJeWyrJuNKUSSr9zd15M42UfAiWzmQKQS8oJlSV7mtsvtOixGcCcWbnVIm0cx6
\r
33 88QIzJAp46Hqzbz73vEjGQ+nu446TE/MqFGwlNllMewi1ihAdaa4NyyL60yt9KFkP1OU
\r
34 Yt+X1jOusqDveXV2cXJKagDOSUloK7GjdEMJIEDKLNA5P0T0pPDrW9CiGiHk2Rgn7CmD
\r
36 X-Received: by 10.140.28.11 with SMTP id 11mr25339985qgy.94.1447010159288;
\r
37 Sun, 08 Nov 2015 11:15:59 -0800 (PST)
\r
38 Received: from localhost (c-24-218-80-235.hsd1.ma.comcast.net.
\r
39 [24.218.80.235]) by smtp.gmail.com with ESMTPSA id
\r
40 b63sm3411616qka.31.2015.11.08.11.15.58 (version=TLSv1.2
\r
41 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Nov 2015 11:15:58
\r
43 Sender: Steven <stebalien@gmail.com>
\r
44 Date: Sun, 8 Nov 2015 14:15:36 -0500
\r
45 From: Steven Allen <steven@stebalien.com>
\r
46 To: Jani Nikula <jani@nikula.org>
\r
47 Cc: notmuch@notmuchmail.org
\r
48 Subject: Re: [PATCH] Add a method to reparent threads to the database.
\r
49 Message-ID: <20151108191536.GA3115@stebalien.com>
\r
50 References: <1446408428-7703-1-git-send-email-steven@stebalien.com>
\r
51 <1446930269-4865-1-git-send-email-steven@stebalien.com>
\r
52 <878u6875p0.fsf@nikula.org>
\r
54 Content-Type: multipart/signed; micalg=pgp-sha256;
\r
55 protocol="application/pgp-signature"; boundary="LZvS9be/3tNcYl/X"
\r
56 Content-Disposition: inline
\r
57 In-Reply-To: <878u6875p0.fsf@nikula.org>
\r
58 Phone: +1-310-433-5865
\r
59 X-PGP-Key: https://stebalien.com/assets/media/uploads/key.pgp
\r
60 X-PGP-Fingerprint: 327B 20CE 21EA 68CF A774 8675 7C92 3221 5899 410C
\r
61 User-Agent: Mutt/1.5.23.1 (2014-03-12)
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.20
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Sun, 08 Nov 2015 19:16:09 -0000
\r
78 Content-Type: text/plain; charset=us-ascii
\r
79 Content-Disposition: inline
\r
80 Content-Transfer-Encoding: quoted-printable
\r
82 I'm writing high-level rust bindings for notmuch and would like to
\r
83 enable encapsulation of query logic. That is, I'd like to be able to
\r
84 write a function that performs a (set of) query(s) and returns a (or a
\r
85 set of) message(s)/thread(s). I can't do this currently because the
\r
86 messages/threads can't outlive the query. I could use reference counting
\r
87 to store the query until all messages/threads have been freed but that
\r
88 feels messy and shouldn't, strictly speaking, be necessary.
\r
90 On 11-08-15, Jani Nikula wrote:
\r
91 > On Sat, 07 Nov 2015, Steven Allen <steven@stebalien.com> wrote:
\r
92 > > This allows threads yielded from a query to outlive the query.
\r
94 > We have a leaky abstraction in the interface. We don't properly define
\r
95 > object lifetimes and ownership, but we have slightly vague references to
\r
96 > them, and the users of the interface pretty much have to respect
\r
97 > them. We try to hide talloc and its concepts.
\r
99 > I think this patch makes the situation slightly worse.
\r
101 > I'd like to understand why this change is better than just holding on to
\r
102 > the query object. The memory saving is neglible.
\r
109 > > lib/notmuch.h | 11 +++++++++++
\r
110 > > lib/thread.cc | 6 ++++++
\r
111 > > 2 files changed, 17 insertions(+)
\r
113 > > diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
114 > > index 310a8b8..9a2869b 100644
\r
115 > > --- a/lib/notmuch.h
\r
116 > > +++ b/lib/notmuch.h
\r
117 > > @@ -1188,6 +1188,17 @@ notmuch_tags_t *
\r
118 > > notmuch_thread_get_tags (notmuch_thread_t *thread);
\r
121 > > + * Reparent a notmuch_thread_t object onto the database.
\r
123 > > + * Calling this function allows a notmuch_thread_t object to outlive i=
\r
125 > > + * query. The query will automatically be reclaimed when the database =
\r
127 > > + * destroyed but if you want to free its memory before then, you shoul=
\r
129 > > + * notmuch_thread_destroy.
\r
132 > > +notmuch_thread_own (notmuch_thread_t *thread);
\r
135 > > * Destroy a notmuch_thread_t object.
\r
138 > > diff --git a/lib/thread.cc b/lib/thread.cc
\r
139 > > index 0c937d7..06fa155 100644
\r
140 > > --- a/lib/thread.cc
\r
141 > > +++ b/lib/thread.cc
\r
142 > > @@ -623,3 +623,9 @@ notmuch_thread_destroy (notmuch_thread_t *thread)
\r
144 > > talloc_free (thread);
\r
148 > > +notmuch_thread_own (notmuch_thread_t *thread)
\r
150 > > + talloc_steal (thread->notmuch, thread);
\r
155 > > _______________________________________________
\r
156 > > notmuch mailing list
\r
157 > > notmuch@notmuchmail.org
\r
158 > > https://notmuchmail.org/mailman/listinfo/notmuch
\r
163 ((Do Not Email <honeypot@stebalien.com>))
\r
166 Content-Type: application/pgp-signature; name="signature.asc"
\r
168 -----BEGIN PGP SIGNATURE-----
\r
171 iQIcBAEBCAAGBQJWP59VAAoJEGVqlrqQ0li+qUUP+wYIs9NZRkWMZqloj7vOQk8+
\r
172 AYPbtMftSXmyRg2F96wGAF3rM3NsYflVWT2qHvI6afjXpbVoq4ewVEFsN2/6lyVJ
\r
173 AiEFk6YwNfozUEwY4WOjZk977A07DOhY4Yw/W0wYlE9C2F+nhgSD2hlQ8ASzZDPe
\r
174 PG1JRe+Z9Iy2SdKZSvxn3bkSU1T+BqqCh6OETdO3lD3cPDRXvlO0c5oLdin8d5p4
\r
175 JmD6V8wlDGbpCDBym8i39QuQKwPN12F3wtfv4XEBaxnuQQDYN89iZlFEoqbvuUY0
\r
176 6q1Rn3pYZMJqf2eQOZqT9BsHu87Xl4q3lTypS6D1m4bMrFdLy4Vx0wzTrCYOnwo3
\r
177 b3ZP9dSaCCIfVnvXhA6lBrbHDEmkCEyVtL4nQCWXYb7awvSIopmHNUjVC2idF/LN
\r
178 +PM8P3FoMcwnGzCwuMOk9GrUws8wLRBFh2jt95PILJMJ+bOyH5r718BuST89pySp
\r
179 tA1f99hupV+I2URPQbinpOq7ZODAA2dEG0O4bNm3VhQyd3UGZgMSuWspjiOJOKo3
\r
180 p1ZBeYX/Gn8+q08uHNpQ4SyZj1cLmhjDbUl1nH3ktws+dHVuGfNS10H2ZbID1f6U
\r
181 KMgcZZc+p6R4JBpB2UQ/jzHhrPzP6WAIyuLNCYi0gCCeQKGQz2QVIyv8tL2t0tnP
\r
182 AVbzvXfdrtdfr36L3/r6
\r
184 -----END PGP SIGNATURE-----
\r
186 --LZvS9be/3tNcYl/X--
\r