|
12 | 12 | ;; schema level. |
13 | 13 | :email/id {:db/valueType :db.type/string} |
14 | 14 | :email/source {:db/valueType :db.type/string} |
15 | | - :email/message-id {:db/valueType :db.type/string |
| 15 | + ;; Raw Message-Id, kept verbatim for display/export. NOT unique: |
| 16 | + ;; identity and lookups go through the fixed-length hash below (raw |
| 17 | + ;; mids can exceed LMDB's key limit). |
| 18 | + :email/message-id {:db/valueType :db.type/string} |
| 19 | + ;; SHA-256 hex of the raw mid (bone.common/mid-hash). |
| 20 | + :email/message-id-hash {:db/valueType :db.type/string |
16 | 21 | :db/unique :db.unique/identity} |
17 | 22 | :email/subject {:db/valueType :db.type/string} |
18 | 23 | :email/from-name {:db/valueType :db.type/string} |
|
48 | 53 | :attachment/data {:db/valueType :db.type/string} |
49 | 54 | :email/in-reply-to {:db/valueType :db.type/string} |
50 | 55 | :email/references {:db/valueType :db.type/string} |
51 | | - ;; Ancestors-mids: persisted union of References + In-Reply-To, |
52 | | - ;; one entry per ancestor message-id. Indexed multi-valued so the |
53 | | - ;; pending-thread retry can locate emails sharing a thread in O(hits). |
54 | | - :email/ancestor-mids {:db/valueType :db.type/string |
| 56 | + ;; Mid-hashes of References + In-Reply-To, one entry per ancestor; |
| 57 | + ;; used by the pending-thread retry. Ordered raw ancestors are |
| 58 | + ;; recomputed from the headers (digest/ancestor-mids). |
| 59 | + :email/ancestor-mid-hashes {:db/valueType :db.type/string |
55 | 60 | :db/cardinality :db.cardinality/many} |
56 | 61 | ;; Set when an email is ingested while its In-Reply-To target is |
57 | 62 | ;; absent from the DB. Phase 3/4 of process-email! is skipped on |
|
83 | 88 | ;; email's author-address when a maintainer uses the `-by` form. |
84 | 89 | :report/type {:db/valueType :db.type/keyword} |
85 | 90 | :report/email {:db/valueType :db.type/ref} |
86 | | - :report/message-id {:db/valueType :db.type/string |
| 91 | + ;; Raw root Message-Id, kept verbatim for display/export; identity |
| 92 | + ;; and lookups go through the hash (as for :email/message-id). |
| 93 | + :report/message-id {:db/valueType :db.type/string} |
| 94 | + :report/message-id-hash {:db/valueType :db.type/string |
87 | 95 | :db/unique :db.unique/identity} |
88 | 96 | :report/version {:db/valueType :db.type/string} |
89 | 97 | :report/patch-seq {:db/valueType :db.type/string} |
|
150 | 158 |
|
151 | 159 | ;; --- Votes (one entity per voter per report) --- |
152 | 160 | :vote/key {:db/valueType :db.type/string |
153 | | - :db/unique :db.unique/identity} ;; "report-mid:voter-addr" |
| 161 | + :db/unique :db.unique/identity} ;; "report-mid-hash:voter-addr" |
154 | 162 | :vote/report {:db/valueType :db.type/ref} |
155 | 163 | :vote/email {:db/valueType :db.type/ref} |
156 | 164 | :vote/value {:db/valueType :db.type/keyword} ;; :up :down :null |
|
0 commit comments