diff options
author | Eric Wong <e@yhbt.net> | 2020-06-21 00:21:33 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-23 00:22:18 +0000 |
commit | 5759c29ba5e0c8b2b1135e528e133dc7dde219f8 (patch) | |
tree | 841e315a7c4c54910bcc72868f4eb92a51fcc092 /lib/PublicInbox/Msgmap.pm | |
parent | 3ba0028804c50b75b1854d0c2bf637ebce0aa8b1 (diff) | |
download | public-inbox-5759c29ba5e0c8b2b1135e528e133dc7dde219f8.tar.gz |
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.
Diffstat (limited to 'lib/PublicInbox/Msgmap.pm')
-rw-r--r-- | lib/PublicInbox/Msgmap.pm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/PublicInbox/Msgmap.pm b/lib/PublicInbox/Msgmap.pm index d115cbce..aa07e344 100644 --- a/lib/PublicInbox/Msgmap.pm +++ b/lib/PublicInbox/Msgmap.pm @@ -270,4 +270,30 @@ sub atfork_prepare { %$self = (tmp_name => $f, pid => $$); } +sub skip_artnum { + my ($self, $skip_artnum) = @_; + return meta_accessor($self, 'skip_artnum') if !defined($skip_artnum); + + my $cur = num_highwater($self) // 0; + if ($skip_artnum < $cur) { + die "E: current article number $cur ", + "exceeds --skip-artnum=$skip_artnum\n"; + } else { + my $ok; + for (1..10) { + my $mid = 'skip'.rand.'@'.rand.'.example.com'; + $ok = mid_set($self, $skip_artnum, $mid); + if ($ok) { + mid_delete($self, $mid); + last; + } + } + $ok or die '--skip-artnum failed'; + + # in the future, the indexer may use this value for + # new messages in old epochs + meta_accessor($self, 'skip_artnum', $skip_artnum); + } +} + 1; |