From 6ff03ba2be9247f1ead26c2524fadc789de558f1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 2 Jun 2021 10:03:25 +0000 Subject: lei export-kw: do not write directly to mail_sync.sqlite3 Only the lei/store process should be writing to files/DBs in lei/store. --- lib/PublicInbox/LeiStore.pm | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/LeiStore.pm') diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm index 6888afb4..821782b9 100644 --- a/lib/PublicInbox/LeiStore.pm +++ b/lib/PublicInbox/LeiStore.pm @@ -193,15 +193,30 @@ sub remove_eml_vmd { # remove just the VMD \@docids; } -sub set_sync_info { - my ($self, $oidhex, $folder, $id) = @_; - ($self->{lms} //= do { +sub _lms_rw ($) { + my ($self) = @_; + $self->{lms} //= do { require PublicInbox::LeiMailSync; my $f = "$self->{priv_eidx}->{topdir}/mail_sync.sqlite3"; my $lms = PublicInbox::LeiMailSync->new($f); $lms->lms_begin; $lms; - })->set_src($oidhex, $folder, $id); + }; +} + +sub lms_clear_src { + my ($self, $folder, $id) = @_; + _lms_rw($self)->clear_src($folder, $id); +} + +sub lms_mv_src { + my ($self, $folder, $oidbin, $id, $newbn) = @_; + _lms_rw($self)->mv_src($folder, $oidbin, $id, $newbn); +} + +sub set_sync_info { + my ($self, $oidhex, $folder, $id) = @_; + _lms_rw($self)->set_src($oidhex, $folder, $id); } sub _remove_if_local { # git->cat_async arg -- cgit v1.2.3-24-ge0c7