]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
(ext)index: eliminate most uses of `$sync->{ibx}'
authorEric Wong <e@80x24.org>
Fri, 10 Jan 2025 23:19:03 +0000 (23:19 +0000)
committerEric Wong <e@80x24.org>
Tue, 14 Jan 2025 04:45:38 +0000 (04:45 +0000)
Yet another step towards eliminating the $sync structure.
There's still a few remaining dependencies due to cross-inbox
linkage but the goal is to reduce refcount traffic for the
majority of Inbox object references.  This field in $sync will
be completely eliminated in the next few commits.

lib/PublicInbox/ExtSearchIdx.pm
lib/PublicInbox/V2Writable.pm

index 32cdd0907b65ff3971dc754b1a1747c17e9c2895..76699c6b3befaa4e81fae977bd8f4c4b7e56a8b6 100644 (file)
@@ -375,8 +375,8 @@ sub unindex_oid { # git->cat_async callback for 'd'
 sub last_commits {
        my ($self, $sync) = @_;
        my $heads = [];
-       my $ekey = $sync->{ibx}->eidx_key;
-       my $uv = $sync->{ibx}->uidvalidity;
+       my $ekey = $self->{ibx}->eidx_key;
+       my $uv = $self->{ibx}->uidvalidity;
        for my $i (0..$sync->{epoch_max}) {
                $heads->[$i] = $self->{oidx}->eidx_meta("lc-v2:$ekey//$uv;$i");
        }
@@ -1170,7 +1170,7 @@ sub update_last_commit { # overrides V2Writable
        my $unit = $sync->{unit} // return;
        my $latest_cmt = $stk ? $stk->{latest_cmt} : $self->{latest_cmt};
        defined($latest_cmt) or return;
-       my $ibx = $sync->{ibx} or die 'BUG: {ibx} missing';
+       my $ibx = $self->{ibx} or die 'BUG: {ibx} missing';
        my $ekey = $ibx->eidx_key;
        my $uv = $ibx->uidvalidity;
        my $epoch = $unit->{epoch};
index e5d54dc6f5bb4b9d313a3f975eaaebc4e2a19ad3..0606c99f371d16d2993d27c62c1dabf698312b62 100644 (file)
@@ -912,12 +912,12 @@ sub sync_prepare ($$) {
        $sync->{ranges} = sync_ranges($self, $sync);
        my $pr = $self->{-opt}->{-progress};
        my $regen_max = 0;
-       my $head = $sync->{ibx}->{ref_head} || 'HEAD';
+       my $head = $self->{ibx}->{ref_head} || 'HEAD';
        my $pfx;
        local $self->{D}; # delete state
        if ($pr) {
-               ($pfx) = ($sync->{ibx}->{inboxdir} =~ m!([^/]+)\z!g);
-               $pfx //= $sync->{ibx}->{inboxdir};
+               ($pfx) = ($self->{ibx}->{inboxdir} =~ m!([^/]+)\z!g);
+               $pfx //= $self->{ibx}->{inboxdir};
        }
 
        my $reindex_heads;
@@ -927,7 +927,7 @@ sub sync_prepare ($$) {
                # what's in the per-inbox index.
                $reindex_heads = [];
                my $v = PublicInbox::Search::SCHEMA_VERSION;
-               my $mm = $sync->{ibx}->mm;
+               my $mm = $self->{ibx}->mm;
                for my $i (0..$sync->{epoch_max}) {
                        $reindex_heads->[$i] = $mm->last_commit_xap($v, $i);
                }
@@ -938,7 +938,7 @@ sub sync_prepare ($$) {
        }
        $self->{max_size} = $self->{-opt}->{max_size} and
                $self->{index_oid} = $self->can('index_oid');
-       my $git_pfx = "$sync->{ibx}->{inboxdir}/git";
+       my $git_pfx = "$self->{ibx}->{inboxdir}/git";
        for (my $i = $sync->{epoch_max}; $i >= 0; $i--) {
                my $git_dir = "$git_pfx/$i.git";
                -d $git_dir or next; # missing epochs are fine