about summary refs log tree commit homepage
path: root/lib/PublicInbox/Lock.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-31 13:51:27 +0000
committerEric Wong <e@80x24.org>2021-01-01 05:00:38 +0000
commit7f17df5c6f1892ef53f149a0ab24a5d917cce7d9 (patch)
treec407a37a4805a2bcd2b1d797ba0f8e343e36dea5 /lib/PublicInbox/Lock.pm
parent49350d47032788a7c1213a64e81ad07fc2d41b65 (diff)
downloadpublic-inbox-7f17df5c6f1892ef53f149a0ab24a5d917cce7d9.tar.gz
--augment will match the mairix(1) option of the same
name to augment existing search results.  We'll need
to implement deduplication for a better user experience.

mutt ships with compressed mbox support for bz2 and xz,
at least, so we'll support those out-of-the-box.
Diffstat (limited to 'lib/PublicInbox/Lock.pm')
-rw-r--r--lib/PublicInbox/Lock.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/PublicInbox/Lock.pm b/lib/PublicInbox/Lock.pm
index 7fd17745..f6eaa5ce 100644
--- a/lib/PublicInbox/Lock.pm
+++ b/lib/PublicInbox/Lock.pm
@@ -8,6 +8,7 @@ use v5.10.1;
 use Fcntl qw(:flock :DEFAULT);
 use Carp qw(croak);
 use PublicInbox::OnDestroy;
+use File::Temp ();
 
 # we only acquire the flock if creating or reindexing;
 # PublicInbox::Import already has the lock on its own.
@@ -40,4 +41,10 @@ sub lock_for_scope {
         PublicInbox::OnDestroy->new(\&lock_release, $self);
 }
 
+sub new_tmp {
+        my ($cls, $ident) = @_;
+        my $tmp = File::Temp->new("$ident.lock-XXXXXX", TMPDIR => 1);
+        bless { lock_path => $tmp->filename, tmp => $tmp }, $cls;
+}
+
 1;