about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-10-27 07:54:35 +0000
committerEric Wong <e@80x24.org>2020-11-07 10:21:48 +0000
commit0c1b80c3b445f20cbb9f753ec9e28117bd9c9c96 (patch)
tree89bdd7adf9aeef9dcd169f113b5b7c8f7c490662 /lib
parentfe0da19e2917a47d7366a8c67e39a035f6018fd6 (diff)
downloadpublic-inbox-0c1b80c3b445f20cbb9f753ec9e28117bd9c9c96.tar.gz
Now that the V2Writable code is more generic, we can
sync with it to use `units' which represent either
a v2 epoch or an entire v1 inbox.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/ExtSearchIdx.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index 5e72d65d..32c57188 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -27,7 +27,7 @@ use PublicInbox::Eml;
 use File::Spec;
 
 sub new {
-        my (undef, $dir, $opt, $shard) = @_;
+        my (undef, $dir, $opt) = @_;
         my $l = $opt->{indexlevel} // 'full';
         $l !~ $PublicInbox::SearchIdx::INDEXLEVELS and
                 die "invalid indexlevel=$l\n";
@@ -249,15 +249,16 @@ sub _sync_inbox ($$$) {
                 defined($ibx->git_dir_latest(\$epoch_max)) or return;
                 $sync->{epoch_max} = $epoch_max;
                 sync_prepare($self, $sync) or return;
-                index_epoch($self, $sync, $_) for (0..$epoch_max);
         } elsif ($v == 1) {
                 my $uv = $ibx->uidvalidity;
                 my $lc = $self->{oidx}->eidx_meta("lc-v1:$ekey//$uv");
-                prepare_stack($sync, $lc ? "$lc..HEAD" : 'HEAD');
+                my $stk = prepare_stack($sync, $lc ? "$lc..HEAD" : 'HEAD');
+                my $unit = { stack => $stk, git => $ibx->git };
         } else {
                 warn "E: $ekey unsupported inbox version (v$v)\n";
                 return;
         }
+        index_todo($self, $sync, $_) for @{$sync->{todo}};
 }
 
 sub eidx_sync { # main entry point
@@ -266,6 +267,8 @@ sub eidx_sync { # main entry point
         $self->{oidx}->rethread_prepare($opt);
 
         _sync_inbox($self, $opt, $_) for (@{$self->{ibx_list}});
+        $self->{oidx}->rethread_done($opt);
+        PublicInbox::V2Writable::done($self);
 }
 
 sub idx_init { # similar to V2Writable
@@ -309,6 +312,8 @@ no warnings 'once';
 *parallel_init = \&PublicInbox::V2Writable::parallel_init;
 *nproc_shards = \&PublicInbox::V2Writable::nproc_shards;
 *sync_prepare = \&PublicInbox::V2Writable::sync_prepare;
-*index_epoch = \&PublicInbox::V2Writable::index_epoch;
+*index_todo = \&PublicInbox::V2Writable::index_todo;
+*count_shards = \&PublicInbox::V2Writable::count_shards;
+*atfork_child = \&PublicInbox::V2Writable::atfork_child;
 
 1;