--- /dev/null
+Return-Path: <aclements@csail.mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id B5FED431FC0\r
+ for <notmuch@notmuchmail.org>; Fri, 3 Oct 2014 07:19:38 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id MqKcR4g5aw01 for <notmuch@notmuchmail.org>;\r
+ Fri, 3 Oct 2014 07:19:32 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu\r
+ [18.9.25.12])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id D09B0431FCB\r
+ for <notmuch@notmuchmail.org>; Fri, 3 Oct 2014 07:19:25 -0700 (PDT)\r
+X-AuditID: 1209190c-f795e6d000006c66-53-542eb06c3c9d\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 74.34.27750.C60BE245; Fri, 3 Oct 2014 10:19:24 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s93EJN9t018545; \r
+ Fri, 3 Oct 2014 10:19:23 -0400\r
+Received: from drake.dyndns.org\r
+ (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+ [216.15.114.40]) (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s93EJLIo023314\r
+ (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT);\r
+ Fri, 3 Oct 2014 10:19:22 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.84)\r
+ (envelope-from <aclements@csail.mit.edu>)\r
+ id 1Xa3hZ-0002Js-5M; Fri, 03 Oct 2014 10:19:21 -0400\r
+From: Austin Clements <aclements@csail.mit.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 05/11] lib: Update database schema doc for ghost messages\r
+Date: Fri, 3 Oct 2014 10:19:12 -0400\r
+Message-Id: <1412345958-8278-6-git-send-email-aclements@csail.mit.edu>\r
+X-Mailer: git-send-email 2.1.0\r
+In-Reply-To: <1412345958-8278-1-git-send-email-aclements@csail.mit.edu>\r
+References: <1412345958-8278-1-git-send-email-aclements@csail.mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsUixCmqrZuzQS/EYNVZcYvrN2cyOzB6PFt1\r
+ izmAMYrLJiU1J7MstUjfLoEr49/MjWwFM/krmvb8Z2xg/MvdxcjJISFgInFy00YWCFtM4sK9\r
+ 9WxdjFwcQgKzmSSmnvvEDJIQEtjAKDFhSQJE4jaTxL3W3YwQzhJGidm3jzKCVLEJ6EusWDuJ\r
+ FcQWEZCW2Hl3NpDNwcEsoCbxp0sFJCws4Ckx99VhsG0sAqoSB7cfAGvlFXCTuL/hEBPEFXIS\r
+ G3b/B4tzCrhLXLj7lA3iCDeJVce62SYw8i9gZFjFKJuSW6Wbm5iZU5yarFucnJiXl1qka6iX\r
+ m1mil5pSuokRHDSSPDsY3xxUOsQowMGoxMP74YZuiBBrYllxZe4hRkkOJiVR3srFeiFCfEn5\r
+ KZUZicUZ8UWlOanFhxglOJiVRHgXrATK8aYkVlalFuXDpKQ5WJTEeTf94AsREkhPLEnNTk0t\r
+ SC2CycpwcChJ8LavB2oULEpNT61Iy8wpQUgzcXCCDOcBGg5Ww1tckJhbnJkOkT/FqCglzvtw\r
+ HVBCACSRUZoH1wuL6leM4kCvCPN2gbTzABMCXPcroMFMQIPf2euCDC5JREhJNTCKMc7m6f56\r
+ yr2YgWm9sNsuobtLo5r8d3eFFM9JW8V0TWh1xDZRIaU2zXueuUIe6dt1D8YGHv+ibPPB5phl\r
+ myqXup4tV+vx1Fseq/5urdXI2hgoOz/pT+/E4PcPrj6/abHz+4Oli9kOFjQ8er1W0qyloahv\r
+ iVjY9x/K52+Fenr1J9cuPh9lf0aJpTgj0VCLuag4EQBg99rnxQIAAA==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 03 Oct 2014 14:19:38 -0000\r
+\r
+From: Austin Clements <amdragon@mit.edu>\r
+\r
+This describes the structure of ghost mail documents. Ghost messages\r
+are not yet implemented.\r
+---\r
+ lib/database.cc | 20 ++++++++++++++++++--\r
+ 1 file changed, 18 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 8fd7fad..c641bcd 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -50,8 +50,8 @@ typedef struct {\r
+ \r
+ /* Here's the current schema for our database (for NOTMUCH_DATABASE_VERSION):\r
+ *\r
+- * We currently have two different types of documents (mail and\r
+- * directory) and also some metadata.\r
++ * We currently have three different types of documents (mail, ghost,\r
++ * and directory) and also some metadata.\r
+ *\r
+ * Mail document\r
+ * -------------\r
+@@ -109,6 +109,15 @@ typedef struct {\r
+ *\r
+ * The data portion of a mail document is empty.\r
+ *\r
++ * Ghost mail document [if NOTMUCH_FEATURE_GHOSTS]\r
++ * -----------------------------------------------\r
++ * A ghost mail document is like a mail document, but where we don't\r
++ * have the message content. These are used to track thread reference\r
++ * information for messages we haven't received.\r
++ *\r
++ * A ghost mail document has type: ghost; id and thread fields that\r
++ * are identical to the mail document fields; and a MESSAGE_ID value.\r
++ *\r
+ * Directory document\r
+ * ------------------\r
+ * A directory document is used by a client of the notmuch library to\r
+@@ -172,6 +181,13 @@ typedef struct {\r
+ * generated is 1 and the value will be\r
+ * incremented for each thread ID.\r
+ *\r
++ * Obsolete metadata\r
++ * -----------------\r
++ *\r
++ * If ! NOTMUCH_FEATURE_GHOSTS, there are no ghost mail documents.\r
++ * Instead, the database has the following additional database\r
++ * metadata:\r
++ *\r
+ * thread_id_* A pre-allocated thread ID for a particular\r
+ * message. This is actually an arbitrarily large\r
+ * family of metadata name. Any particular name is\r
+-- \r
+2.1.0\r
+\r