-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hcache.txt
203 lines (163 loc) · 4.94 KB
/
hcache.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
bcache
why isn't it in maildir format?
touch files, utime(2), to SENT_DATE
doc crontab for cleanup
plan to integrate offlineimap as bcache
might need folder-name translation to match offlineimap
hcache that works offline!
use hcache to store other info?
e.g. top tips - which are read
is hcache data hashed on fields in db, or all fields?
i.e. why does HCACHEVER change so often
use startup hook & scripting + offline hcache
to locally cache email
local cache => strictly readonly
gahr, hcache
one formatting string
+/- override format strings
separate code files
autoconf hcache=X
separate code dir?
hcache/*
all via hcache.h
.so dyanamic library
conflicts autoconf a bit
multiple static/dynamic
global?
per mailbox?
break deps on mutt structs
rename "ctx" -- too confusing
multiple hcaches => RAID-like write many, read fastest
two caches, local and shared?
merge hcache docs?
hcache
when it's done, create an hcache test rig
only use hcache API
easy task to rejig list of hcache backends
highlight current one?
X Y (Cur) Z
Cur (X Y Z)
hcache: x [y] z
y = default
only make sense after reading config?
hcache
is it a binary blob based on HEADER?
what causes cache invalidation?
change of size, order? count of fields?
change of endianness
does hcache *need* to know about what's in the binary blob?
just needs *key* to seed hash of data (data, len)
hcache *doesn't* need to know about mutt
key needs to be hashed on db name too
when done, move to hcache/ dir
hcache files .<backend> suffix?
config "file" vs "dir/" is ugly and confusing
eliminate #ifdef USE_HCACHE for
int mh_sync_mailbox_message(struct Context *ctx, int msgno, header_cache_t *hc);
void * typedef if not def'd
hcache move conditionals to end of struct?
timestamp hcache entries for garbage collection
gc may not reduce size of db file
have cache settings per account (or per folder), with flags
PREFETCH_ALL
all hc dump functions should be const
need to disentagle dump_char_size first
move CharsetIsUtf8 out of hcache (param)
hcache namer
split (root, dir, name) triplet?
check header and msg cache for dirs containing whitespace
e.g. "Bulk Mail"
split the hcache serialisation by struct
address_serialise
buffer_serialise
etc
each struct calls the children it needs
put in some version numbers, or
field type and length bytes before each field
hcache pruner
use list of mailboxes
use list of backends (you want)
won't work for caching files, only folders
unless we trawl through EVERY email
might as well cache them too
hcache auto magic everything
sync web & contrib versions of hcache benchmarks
how?
have a NULL cache which is just a copy of the email
might *still* need a DB of some info
tie into offlineimap
cache files need to hash their name too
to avoid two systems "sharing" a single hash
and crashing
hcache2 (bitfields)
inline, transparent
where are the magic structs in the code?
address/address.h
email/body.h
email/email.h
email/envelope.h
email/parameter.h
mutt/buffer.h
mutt/list.h
separate files for each magic struct to reduce dependencies?
--------------------------------------------------------------------------------
the header cache keys seem to include the full path
if we have separate caches per Mailbox, then we don't need them
key should be JUST the canonical name
for maildir that means no path, no flags
probably ought to drop the ,S=6074,W=6162 fields too
all the keys are paths, IDs or hashes
add a separate data key with info
_NEO_DATA
version of _NEO_DATA
neomutt-version
mailbox type
path
creation date
CRC for this data
check this data on opening the cache
split dir and key
don't save dir for *dir* cache
eliminate UIDVALIDITY? UIDNEXT?
fold into key?
or into cache name?
#1870
strip each struct
each in separate header file
move cached first
comment marking END
store as memcpy for speed and space?
hcache leak?
enable compression
open hcache
disable compression
close hcache
see
mutt_hcache_close()
if (C_HeaderCacheCompressMethod)
compr_get_ops()->close(&hc->cctx);
need to save compress ops in `hc`
add hcache warning
I wonder if neomutt should warn me about this
"hey you have configured header_cache=foo/ but foo is a file, not a directory"
hcache leaking
lmdb 4 + 3*Account + 2*Mailbox objects
maildir 2*Account + 2*Mailbox objects
hcache lazy_malloc/realloc
who else uses similar scheme, Buffer?
move to library
investigate the 129 reallocs in neomutt
# Number of days to retain header/body cache records
set hcache_expiry_time=90
on first timeout, `find ~/.cache -mtime +$hcache_expiry_time -delete`
empty db files of old records too
this means reading each record and each one having a timestamp
change this to a cli option
neomutt [options] --tidy-cache=30 (days)
display results to user
x headers deleted, y messages deleted
debug tool to dump a header cache file
need to identify *which* db type
need to check version of neomutt (HCACHEVER)
sanity-check the data, then dump it
see _NEO_DATA above