Warning, /pim/trojita/docs/proposed-extensions/draft-kundrat-incthread.xml is written in an unsupported language. File is not indexed.

0001 <?xml version="1.0" encoding="US-ASCII"?>
0002 <!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
0003 
0004 <!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
0005 <!ENTITY RFC5234 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5234.xml">
0006 <!ENTITY RFC3501 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3501.xml">
0007 <!ENTITY RFC4466 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4466.xml">
0008 <!ENTITY RFC4731 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4731.xml">
0009 <!ENTITY RFC5256 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5256.xml">
0010 <!ENTITY RFC5267 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5267.xml">
0011 <!ENTITY DRAFT-inthread SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-ietf-morg-inthread-01.xml">
0012 ]>
0013 <?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
0014 <?rfc strict="yes" ?>
0015 <?rfc toc="yes"?>
0016 <?rfc tocdepth="4"?>
0017 <?rfc symrefs="yes"?>
0018 <?rfc sortrefs="yes" ?>
0019 <?rfc compact="yes" ?>
0020 <?rfc subcompact="no" ?>
0021 <rfc category="std" docName="draft-kundrat-incthread-02" ipr="trust200902">
0022 
0023   <front>
0024     <title abbrev="IMAP INCTHREAD Extension">IMAP Extension for Incremental Threading (INCTHREAD)</title>
0025 
0026     <author fullname="Jan Kundrat" initials="J." surname="Kundrat">
0027       <address>
0028         <postal>
0029           <street>Eledrova 558</street>
0030           <city>Prague</city>
0031           <code>181 00</code>
0032           <country>CZ</country>
0033         </postal>
0034         <email>jkt@flaska.net</email>
0035       </address>
0036     </author>
0037 
0038     <date year="2013" month="August" day="27"/>
0039 
0040     <area>General</area>
0041     <workgroup>Internet Engineering Task Force</workgroup>
0042 
0043     <keyword>IMAP</keyword>
0044     <keyword>THREAD</keyword>
0045     <keyword>INTHREAD</keyword>
0046     <keyword>incremental threading</keyword>
0047     <keyword>ESEARCH</keyword>
0048     <keyword>CONTEXT</keyword>
0049     <keyword>CONTEXT=SORT</keyword>
0050     <keyword>CONTEXT=SEARCH</keyword>
0051     <keyword>CONTEXT=THREAD</keyword>
0052 
0053     <abstract>
0054         <t>This document describes the INCTHREAD IMAP extension which enables clients to retrieve incremental updates of
0055             the mailbox threading.  The extension repurposes the ESEARCH response for passing along the threading
0056             information and builds on top of Arnt Gulbrandsen's work on the INTHREAD search key.  The UID THREAD command
0057             is also extended to allow activating this extension.  Together, these changes make it possible for clients
0058             not to fetch the complete mailbox threading each time a new message arrives.</t>
0059     </abstract>
0060   </front>
0061 
0062   <middle>
0063     <section title="Introduction">
0064         <t>Online IMAP clients which want to conserve the required bandwidth and also show messages in threads to their
0065             users have an option to delegate the message threading to the IMAP server through mechanisms outlines in
0066             <xref target="RFC5256"/>.  Using the UID SEARCH command, clients do not have to download the message headers
0067             (like the Message-Id, References and In-Reply-To), and can instead fetch the resulting thread mapping of all
0068             messages in a mailbox.</t>
0069 
0070         <t>Unfortunately, the savings in transferred data are significantly reduced when clients have to fetch the
0071             thread mapping over and over again, for example when a new message arrives.  Even if the client downloads
0072             the relevant headers of new arrivals, these data alone are not sufficient to determine a proper place where
0073             to insert the newly arriving message.  Furthermore, a single newly arriving message could potentially affect
0074             placement of many messages (or even all of them in a pathological case due to joining of adjacent threads).
0075             This issue prevents using approach similar to the CONTEXT=SEARCH and CONTEXT=SORT extensions <xref
0076                 target="RFC5267"/> where only a position of the new arrival is communicated in an incremental
0077             manner.</t>
0078 
0079         <t>This extension builds on Arnt Gulbrandsen's work <xref target="I-D.ietf-morg-inthread"/> and reuses the
0080             INTHREAD search key defined in said draft.  This search key is used to inform the server that the search
0081             conditions are to refer to all threads containing any messages which match the original search criteria.
0082             However, as the untagged THREAD response does not contain any data about the position of the affected thread
0083             among other threads in the mailbox, support for INTHREAD alone does not relieve the clients from performing
0084             additional operations due to missing information.  A naive workaround where the affected threads are always
0085             placed at the logical end of the mailbox would yield results different from the complete THREAD command when
0086             copying older messages.  Similarly, attempting to reuse the original thread position would significantly
0087             limit the usefulness of the REFS algorithm <xref target="I-D.ietf-morg-inthread"/> which sorts threads with
0088             "fresh messages" at the end of the view.</t>
0089 
0090         <t>Because the THREAD response cannot transmit the position of the resulting thread relative to other threads in
0091             the mailbox, the ESEARCH response <xref target="RFC4731"/> is used and the UID THREAD command is extended to
0092             allow for specifying the return options in manner consistent with how SEARCH and UID SEARCH were modified by
0093             ESEARCH.  Finally, two new ESEARCH return options, the THREAD and the INCTHREAD, are defined.</t>
0094 
0095         <t>These modifications together allow clients to delegate the threading operation completely to the server side
0096             without significantly increasing network traffic even on busy mailboxes.</t>
0097 
0098         <section title="Drawbacks and Alternatives">
0099             <t>This extension can still transfer excessive amounts of data because the commands return complete threads
0100                 instead of incremental difference updates.  However, this approach allows for reusing the clients' and
0101                 servers' existing facilities, both for parsing and response processing.  In addition, unless the
0102                 protocol mandated history tracking of the threading tree, a much intrusive and resource-demanding
0103                 feature, the incremental updates would be only possible in case where the mailbox is currently selected.
0104                 This extension affirms the decision about threading requests to remain on the client side, letting it
0105                 use its policies about when to request full threading information and when to use the incremental
0106                 updates.</t>
0107 
0108             <t>No support for automated updates of the threading data in the sense of the CONTEXT extension <xref
0109                     target="RFC5267"/> are defined at this point.  This might change based on feedback from other server
0110                 and client vendors.</t>
0111         </section>
0112 
0113       <section title="Requirements Language">
0114         <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
0115         "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
0116         document are to be interpreted as described in <xref
0117         target="RFC2119">RFC 2119</xref>.</t>
0118       </section>
0119     </section>
0120 
0121     <section title="IMAP Protocol Changes">
0122         <section title="New SEARCH Keys">
0123             <t>This document reuses the INTHREAD search key from <xref target="I-D.ietf-morg-inthread"/> with no changes
0124                 in its meaning or semantics.</t>
0125             <t>Please note that the "INTHREAD" search key and the "INCTHREAD" ESEARCH return option are two distinct
0126                 features.</t>
0127         </section>
0128 
0129         <section title="Modified IMAP Commands">
0130             <section title="Modified UID THREAD Command">
0131                 <t>The UID THREAD command is extended with the following two return options:</t>
0132 
0133                 <t><list style="hanging">
0134                         <t hangText="THREAD">Return the threading information through the ESEARCH response using syntax
0135                             similar to the untagged THREAD response.</t>
0136                         <t hangText="INCTHREAD">Return a dedicated INCTHREAD section for each thread found in the result
0137                             set.</t>
0138                 </list></t>
0139 
0140                 <t>The THREAD and INCTHREAD return options are mutually exclusive.  Servers MUST return a tagged BAD
0141                     response if a client specifies both return options in a single UID THREAD command.</t>
0142 
0143                 <t>Servers MUST use the ESEARCH response instead of the untagged THREAD response when responding to the
0144                     extended form of the UID THREAD command.</t>
0145 
0146                 <t>The THREAD and UID THREAD are two distinct commands.  Because clients are not expected to rely on
0147                     transient identifiers like the message sequence numbers for threading retrieval and storage and
0148                     because of the requirement of using UIDs in the INCTHREAD response, no modification to the THREAD
0149                     command is defined.  This might change in future iterations of this draft if client authors express
0150                     sufficient interest.</t>
0151             </section>
0152         </section>
0153 
0154         <section title="ESEARCH Extension">
0155             <t>Servers announcing the INCTHREAD capability support two new search return options:</t>
0156 
0157             <t><list style="hanging">
0158                     <t hangText="THREAD">Method for conveying the threading information in a form similar to the THREAD
0159                         untagged response.</t>
0160 
0161                     <t hangText="INCTHREAD">Response contains the threading information along with the specification of
0162                         a UID of the previous thread root.</t>
0163             </list></t>
0164 
0165             <section title="The THREAD ESEARCH Return Value">
0166                 <t>The THREAD return value uses the same format as the threading data in the untagged THREAD responses
0167                     <xref target="RFC5256"/>.  This return value is defined to allow clients to easily match data
0168                     received over network with the tag of the command which caused them, as per the usual ESEARCH
0169                     rules.</t>
0170                 <t>Due to the rules of <xref target="RFC4466"/>, the <xref target="RFC5256"/>-styled response is
0171                     enclosed in one extra pair of parentheses when returned as ESEARCH data.  As an example, threading
0172                     data (1)(2 3) are encoded as ((1)(2 3)) when sent in the THREAD ESEARCH response.</t>
0173             </section>
0174 
0175             <section title="The INCTHREAD ESEARCH Return Value">
0176                 <t>The INCTHREAD return value consists of "previous thread root UID" followed by "threading response
0177                     containing a single thread".  The UID of the previous thread root MUST be zero if the thread sorts
0178                     first in the resulting list of threads.  The tuple is enclosed in parentheses to conform to <xref
0179                         target="RFC4466"/>.</t>
0180 
0181                 <t>A dedicated INCTHREAD record MUST be present for each thread contained in the result set.</t>
0182 
0183                 <section title="Processing Incremental Threading Updates">
0184                     <t>At first, the client removes any messages referenced in the received INCTHREAD response from its
0185                         thread mapping.  This step is crucial to allow new arrivals joining previously independent
0186                         threads together.</t>
0187 
0188                     <t>In the second step, the client extracts the threading information from the received INCTHREAD
0189                         response.  The threading data is parsed as in <xref target="RFC5256"/> and the newly formed
0190                         thread is inserted just behind a thread whose root message has UID specified in the "uid"
0191                         argument of the INCTHREAD response.</t>
0192 
0193                     <t>If non-zero, the UID of the previous thread root message MUST refer to the previous thread in a
0194                         mapping which contains all messages from a mailbox.  In particular, no matter what additional
0195                         searching criteria the client has used, the previous thread MUST always be identified without
0196                         any search criteria being applied.</t>
0197 
0198                     <t>If the client supports incremental threading, the INCTHREAD blocks of an ESEARCH response MUST be
0199                         processed in order.  In particular, inserting the newly formed threads to a proper location
0200                         shall happen immediately when the new thread is created because the subsequent responses COULD
0201                         refer to the root message of the just-inserted thread.</t>
0202 
0203                     <t>If the UID is said to be zero (0), it is interpreted specially to mean that the newly formed
0204                         thread is the very first one among the list of threads in the mailbox.  Servers MUST NOT send a
0205                         number which does not refer to any thread root UID unless the number is 0 to indicate the very
0206                         first thread.</t>
0207 
0208                     <t>Clients MUST deal with servers sending a UID which does not refer to any thread root or any
0209                         message in the mailbox.  Is is implementation-defined at which position such thread shall be
0210                         inserted, but the thread MUST appear in the list of threads.</t>
0211                 </section>
0212             </section>
0213         </section>
0214 
0215         <section title="New Capabilities">
0216             <t>This document adds two new IMAP capabilities, the ETHREAD and INCTHREAD.</t>
0217 
0218             <t>Servers announcing the ETHREAD capability support the extended UID THREAD command syntax and the THREAD
0219                 return option.</t>
0220 
0221             <t>Servers supporting the INCTHREAD capability MUST support and announce the ETHREAD capability as well.</t>
0222         </section>
0223     </section>
0224 
0225     <section title="Examples">
0226         <t>This section contains a few examples to illustrate how the INCTHREAD extension operates.</t>
0227 
0228         <section title="General Mode of Operation">
0229             <t>Using the proposed extension, a typical communication between two compliant IMAP protocol speakers might
0230                 look like the following:</t>
0231 
0232             <figure align="center">
0233                 <artwork align="left"><![CDATA[
0234 S: * 666 EXISTS
0235 C: x1 UID FETCH 665:* (FLAGS)
0236 S: * 666 FETCH (UID 1666 FLAGS ())
0237 S: x1 OK fetched
0238 C: x2 UID THREAD RETURN (INCTHREAD) REFS utf-8
0239       INTHREAD REFS 666
0240 S: * ESEARCH (TAG "x2") UID INCTHREAD (400
0241       (600 601 (640 666)(602 603)))
0242 S: x2 OK sent]]></artwork>
0243             </figure>
0244 
0245             <t>The actual resulting message threading looks like the following:</t>
0246             <figure align="center">
0247                 <artwork align="left"><![CDATA[
0248 ...
0249  |
0250  | (All preceding threads are simply skipped.)
0251  |
0252  +-- 400
0253  |    +-- ...
0254  | (No data for the previous thread besides its root node is sent.)
0255  |
0256  +-- 600
0257  |    +-- 601
0258  |         +-- 640
0259  |         |    +-- 666  <-- the new arrival
0260  |         +-- 602
0261  |              +-- 603
0262  |
0263 ... (No data about any subsequent threads is included in the response.)]]></artwork>
0264             </figure>
0265         </section>
0266 
0267         <section title="Inserting a Single Message">
0268             <t>Consider the following threading for a mailbox:</t>
0269 
0270             <figure align="center">
0271                 <artwork align="left"><![CDATA[
0272 C: x1 UID THREAD (RETURN THREAD) REFS utf-8 ALL
0273 S: * ESEARCH (TAG "x2") UID THREAD ((1)(2)(3)(4))
0274 S: x1 OK Threading sent]]></artwork>
0275             </figure>
0276 
0277             <t>Such a response corresponds to the following threading:</t>
0278             <figure align="center">
0279                 <artwork align="left"><![CDATA[
0280  +-- 1
0281  +-- 2
0282  +-- 3
0283  +-- 4]]></artwork>
0284             </figure>
0285 
0286             <t>A new message arrives and the client asks for the reading information:</t>
0287             <figure align="center">
0288                 <artwork align="left"><![CDATA[
0289 S: * 5 EXISTS
0290 S: * 5 FETCH (UID 5)
0291 C: x2 UID THREAD (RETURN INCTHREAD) REFS utf-8 INTHREAD REFS UID 5
0292 S: * ESEARCH (TAG "x2") UID INCTHREAD (2 (3 5))
0293 S: x2 OK Threading sent]]></artwork>
0294             </figure>
0295 
0296             <t>The updated threading information should look like the following:</t>
0297             <figure align="center">
0298                 <artwork align="left"><![CDATA[
0299  +-- 1
0300  +-- 2
0301  +-- 3
0302  |   +-- 5
0303  +-- 4]]></artwork>
0304             </figure>
0305 
0306             <t>In this case, the thread with thread root with UID 4 is still considered "fresher" by the selected thread
0307                 algorithm.</t>
0308             <!--t><vspace blankLines="1"/></t-->
0309         </section>
0310 
0311         <section title="Joining Threads">
0312             <t>The following example shows a more complicated scenario where independent threads are joined together.
0313                 This illustrates the need for clients to remove the referenced messages from their thread mapping:</t>
0314             <figure align="center">
0315                 <artwork align="left"><![CDATA[
0316 C: x1 UID THREAD (RETURN THREAD) REFS utf-8 ALL
0317 S: * ESEARCH (TAG "x2") UID THREAD ((1 2)(3 4)(5))
0318 S: x1 OK Threading sent]]></artwork>
0319             </figure>
0320 
0321             <t>Such a response corresponds to the following threading:</t>
0322             <figure align="center">
0323                 <artwork align="left"><![CDATA[
0324  +-- 1
0325  |   +-- 2
0326  +-- 3
0327  |   +-- 4
0328  +-- 5]]></artwork>
0329             </figure>
0330 
0331             <t>A new response arrives, joining the first two threads in the mailbox together:</t>
0332              <figure align="center">
0333                 <artwork align="left"><![CDATA[
0334 S: * 6 EXISTS
0335 S: * 6 FETCH (UID 6)
0336 C: x2 UID THREAD (RETURN INCTHREAD) REFS utf-8 INTHREAD REFS UID 6
0337 S: * ESEARCH (TAG "x2") UID INCTHREAD (0 (6 (1 2)(3 4)))
0338 S: x2 OK Threading sent]]></artwork>
0339             </figure>
0340            
0341             <t>The newly formed thread remains at the beginning of a mailbox:</t>
0342             <figure align="center">
0343                 <artwork align="left"><![CDATA[
0344  +-- 6           <-- new arrival
0345  |   +-- 1       <-- previous thread #1
0346  |   |   +-- 2
0347  |   +-- 3       <-- previous thread #2
0348  |       +-- 4
0349  +-- 5           <-- previous thread #3 remains as a standalone thread]]></artwork>
0350             </figure>
0351         </section>
0352 
0353     </section>
0354 
0355     <section anchor="Acknowledgements" title="Acknowledgements">
0356         <t>This extension builds upon the SEARCH=INTHREAD extension <xref target="I-D.ietf-morg-inthread"/> and the
0357             THREAD extension <xref target="RFC5256"/>.</t>
0358     </section>
0359 
0360     <section anchor="IANA" title="IANA Considerations">
0361       <t>IMAP4 capabilities are registered by publishing a standards track or IESG approved experimental RFC.  The
0362           registry is currently located at:</t>
0363       <t>http://www.iana.org/assignments/imap4-capabilities</t>
0364       <t>This document defines the ETHREAD and INCTHREAD IMAP capabilities.  IANA will be asked to add these capability
0365           to the registry.</t>
0366     </section>
0367 
0368     <section title="Formal Syntax">
0369         <t>The following syntax specification uses the Augmented Backus-Naur
0370             Form (ABNF) notation as specified in <xref target="RFC5234"/>.</t>
0371 
0372         <t>Non-terminals referenced but not defined below are as defined by <xref target="RFC3501"/>, <xref
0373                 target="RFC4466"/>, <xref target="RFC4731"/>, or <xref target="RFC5256"/>.</t>
0374 
0375         <figure align="center">
0376             <artwork align="left" type="abnf"><![CDATA[
0377 capability          =/ "ETHREAD" / "INCTHREAD"
0378     ;; <capability> from [RFC3501]
0379 
0380 modifier-ethread    = "THREAD"
0381 
0382 modifier-incthread  = "INCTHREAD"
0383 
0384 thread-return-opt   = modifier-thread / modifier-incthread
0385     ;; Similar to <search-return-opt> from [RFC4466]
0386 
0387 ret-data-thread     = "THREAD" [SP "(" 1*thread-list ")" ]
0388     ;; <thread-list> from [RFC5256]
0389 
0390 ret-data-incthread  = "INCTHREAD" SP "(" uid SP thread-list ")"
0391     ;; <uid> from [RFC3501]
0392     ;; <thread-list> from [RFC5256]
0393 
0394 search-return-data  =/ ret-data-thread / ret-data-incthread
0395     ;; <search-return-data> from [RFC4466]
0396 
0397 thread              =/ "UID" SP "THREAD" [thread-return-opts]
0398                        SP thread-alg SP search-criteria
0399     ;; <thread> and <thread-alg> from [RFC5256]
0400     ;; <search-criteria> from [RFC3501] as amended by
0401     ;;   [I-D.ietf-morg-inthread]
0402     ;;
0403     ;; The thread-return-opts MUST contain exactly one of
0404     ;;   modifier-thread or modifier-incthread
0405 
0406 thread-return-opts  = SP "RETURN" SP "(" [thread-return-opt
0407                       *(SP thread-return-opt)] ")"
0408     ;; similar to the <search-return-opts> from [RFC4466]
0409 
0410 ]]></artwork>
0411         </figure>
0412     </section>
0413 
0414     <section anchor="Security" title="Security Considerations">
0415         <t>This document is believed to not have any security implications besides those already implied by <xref
0416                 target="RFC5256"/> and <xref target="I-D.ietf-morg-inthread"/>.</t>
0417     </section>
0418   </middle>
0419 
0420   <back>
0421     <references title="Normative References">
0422       &RFC2119;
0423 
0424       &RFC5234;
0425 
0426       &RFC3501;
0427 
0428       &RFC4466;
0429 
0430       &RFC4731;
0431 
0432       &RFC5256;
0433 
0434       &DRAFT-inthread;
0435     </references>
0436 
0437     <references title="Informative References">
0438       &RFC5267;
0439     </references>
0440 
0441     <section anchor="changelog" title="Changelog">
0442         <section title="Changes in -02 since -01">
0443             <t><list style="symbols">
0444                 <t>Enclose the ESEARCH response data in parentheses to conform with RFC4466.
0445                    Thanks to Alexey Melnikov for his review.</t>
0446             </list></t>
0447         </section>
0448         <section title="Changes in -01 since -00">
0449             <t><list style="symbols">
0450                 <t>Added some clarifications that each INCTHREAD block MUST be processed immediately because the
0451                     subsequent block might refer to its results</t>
0452             </list></t>
0453         </section>
0454     </section>
0455   </back>
0456 </rfc>