From 5759c29ba5e0c8b2b1135e528e133dc7dde219f8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 21 Jun 2020 00:21:33 +0000 Subject: init: add --skip-artnum parameter For archivists with only newer mail archives, this option allows reserving reserve NNTP article numbers for yet-to-be-archived old messages. Indexers will need to be updated to support this feature in future commits. -V1 inboxes will now be initialized with SQLite and Xapian support if this option is used, or if --indexlevel= is specified. --- lib/PublicInbox/InboxWritable.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/InboxWritable.pm') diff --git a/lib/PublicInbox/InboxWritable.pm b/lib/PublicInbox/InboxWritable.pm index c54be046..f9e28502 100644 --- a/lib/PublicInbox/InboxWritable.pm +++ b/lib/PublicInbox/InboxWritable.pm @@ -39,10 +39,21 @@ sub assert_usable_dir { sub init_inbox { my ($self, $shards, $skip_epoch, $skip_artnum) = @_; - # TODO: honor skip_artnum if ($self->version == 1) { my $dir = assert_usable_dir($self); PublicInbox::Import::init_bare($dir); + if (defined($self->{indexlevel}) || defined($skip_artnum)) { + require PublicInbox::SearchIdx; + my $sidx = PublicInbox::SearchIdx->new($self, 1); # just create + $sidx->begin_txn_lazy; + $self->with_umask(sub { + my $mm = PublicInbox::Msgmap->new($dir, 1); + $mm->{dbh}->begin_work; + $mm->skip_artnum($skip_artnum); + $mm->{dbh}->commit; + }) if defined($skip_artnum); + $sidx->commit_txn_lazy; + } } else { my $v2w = importer($self); $v2w->init_inbox($shards, $skip_epoch, $skip_artnum); -- cgit v1.2.3-24-ge0c7