1 % public-inbox developer manual
5 lei-store-format - lei/store format description
9 C<lei/store> is a hybrid store based on L<public-inbox-extindex-format(5)>
10 ("extindex") combined with L<public-inbox-v2-format(5)> ("v2") for blob
11 storage. While v2 is ideal for archiving a single public mailing list;
12 it was never intended for personal mail nor storing multiple
13 blobs of the "same" message.
15 As with extindex, it can index disparate C<List-Id> headers
16 belonging to the "same" message with different git blob OIDs.
17 Unlike v2 and extindex, C<Message-ID> headers are NOT required;
18 allowing unsent draft messages to be stored and indexed.
20 =head1 DIRECTORY LAYOUT
22 Blob storage exists in the form of v2-style epochs. These epochs
23 are under the C<local/> directory (instead of C<git/>) to
24 prevent them from being accidentally treated as a v2 inbox.
26 =head2 INDEX OVERVIEW AND DEFINITIONS
28 $EPOCH - Integer starting with 0 based on time
29 $SCHEMA_VERSION - DB schema version (for Xapian)
30 $SHARD - Integer starting with 0 based on parallelism
32 ~/.local/share/lei/store
33 - ipc.lock # lock file for internal lei IPC
34 - local/$EPOCH.git # normal bare git repositories
35 - mail_sync.sqlite3 # sync state IMAP, Maildir, NNTP
37 Additionally, the following share the same roles they do in extindex:
39 - ei.lock # lock file to protect global state
40 - ALL.git # empty, alternates for local/*.git
41 - ei$SCHEMA_VERSION/$SHARD # per-shard Xapian DB
42 - ei$SCHEMA_VERSION/over.sqlite3 # overview DB for WWW, IMAP
43 - ei$SCHEMA_VERSION/misc # misc Xapian DB
45 =head2 XREF3 DEDUPLICATION
47 Index deduplication follows extindex, see
48 L<public-inbox-extindex-format(5)/XREF3 DEDUPLICATION> for
51 =head2 BLOB DEDUPLICATION
53 The contents of C<local/*.git> repos is deduplicated by git blob
54 object IDs (currently SHA-1). This allows multiple copies of
55 cross-posted and personally Cc-ed messages to be stored with
56 different C<Received:>, C<X-Spam-Status:> and similar headers to
57 allow troubleshooting.
59 =head2 VOLATILE METADATA
61 Keywords and label information (as described in RFC 8621 for JMAP)
62 is stored in existing Xapian shards (C<ei$SCHEMA_VERSION/$SHARD>).
63 It is possible to search for messages matching labels and
64 keywords using C<L:> and C<kw:>, respectively. As with all data
65 stored in Xapian indices, volatile metadata is associated with
66 the Xapian document, thus it is shared across different blobs of
71 When L<lei(1)> is run in daemon mode, L<flock(2)> is used on
72 C<ipc.lock> is used to serialize writes to C<lei/store> across
73 multiple internal lei workers while minimizing commits.
77 Reindexing and synchronization is not yet supported.
81 Thanks to the Linux Foundation for sponsoring the development
86 Copyright 2021 all contributors L<mailto:meta@public-inbox.org>
88 License: AGPL-3.0+ L<http://www.gnu.org/licenses/agpl-3.0.txt>
92 L<public-inbox-v2-format(5)>, L<public-inbox-extindex(5)>