about summary refs log tree commit homepage
path: root/lib/PublicInbox/IMAPTracker.pm
DateCommit message (Collapse)
2021-01-01update copyrights for 2021
Using "make update-copyrights" after setting GNULIB_PATH in my config.mak
2020-08-28imaptracker: update_last: simplify callers
By making it a no-op if last_uid is not defined. This isn't a hot code path, so the extra method dispatch isn't an issue. It'll save some indentation/wrapping in future commits.
2020-08-27imaptracker: preserve WAL journal_mode if set by user
It's no problem for most users to enable WAL, here, since there's only a single process doing both reading and writing (unlike the read-only daemons). However, WAL doesn't work on network filesystems, so it can't be enabled by default.
2020-06-28imaptracker: use flock(2) around writes
SQLite only issues non-blocking F_SETLK ops (not F_SETLKW) and retries failures using a configurable busy_timeout. SQLite's busy loop sleeps for a millisecond and retries the lock until the configured busy_timeout is hit. Trying to set ->sqlite_busy_timeout to larger values (e.g. 30000 milliseconds) still leads to failure when running the new stress test with 8 processes with TMPDIR on a 7200 RPM HDD. Inspection of SQLite source reveals there's no built-in way to use F_SETLKW, so tack on the existing flock(2) support we use to synchronize git + SQLite + Xapian for inbox writing. We use flock(2) instead of POSIX fcntl(2) locks since Perl doesn't provide a way to manipulate "struct flock" portably.
2020-06-28imaptracker: drop {dbname} field
It's not used anywhere since the IMAPTracker object doesn't disconnect and reconnect. If we ever need the filename, {dbh}->sqlite_db_filename may be used. Cc: Eric W. Biederman <ebiederm@xmission.com>
2020-06-28imaptracker: add {url} field to reduce args
Passing a $url parameter to every function was error-prone and having {url} field for a short-lived object is appropriate. This matches the version of IMAPTracker posted by Eric W. Biederman on 2020-05-15 at: https://public-inbox.org/meta/87ftc0c3r4.fsf_-_@x220.int.ebiederm.org/ The version I originally imported was based on the one posted on 2019-10-09: https://public-inbox.org/meta/874l0i9vhc.fsf_-_@x220.int.ebiederm.org/ Cc: Eric W. Biederman <ebiederm@xmission.com>
2020-06-28imaptracker: use ~/.local/share/public-inbox/imap.sqlite3
Respect XDG_DATA_HOME to avoid cluttering ~/.public-inbox/. Existing users of ~/.public-inbox/imap.sqlite3 will remain supported, but the preference for new data is to use ~/.local/share and other paths standardized by XDG. Cc: "Eric W. Biederman" <ebiederm@xmission.com>
2020-06-28IMAPTracker: Add a helper to track our place in reading imap mailboxes
This removes the need to delete from an imap mailbox when downloading it's messages. [ew: minor style changes] Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>