diff options
author | Eric Wong <e@80x24.org> | 2023-05-03 03:11:14 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-05-03 06:48:27 +0000 |
commit | ec0c6db858d34a3a63cf86ddd090e28c28cfca3a (patch) | |
tree | 464e2dfda5e286dff1d3cee520bae5721c070930 /lib/PublicInbox/Admin.pm | |
parent | af358066af69ad92d5ae634b9af63ac301eec287 (diff) | |
download | public-inbox-ec0c6db858d34a3a63cf86ddd090e28c28cfca3a.tar.gz |
This is much easier to support than xcpdb since it's 1:1 and doesn't follow a different sharding scheme than the inboxes and extindices.
Diffstat (limited to 'lib/PublicInbox/Admin.pm')
-rw-r--r-- | lib/PublicInbox/Admin.pm | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm index 96c6652c..72ac9420 100644 --- a/lib/PublicInbox/Admin.pm +++ b/lib/PublicInbox/Admin.pm @@ -50,6 +50,7 @@ sub resolve_any_idxdir ($$) { } sub resolve_eidxdir ($) { resolve_any_idxdir($_[0], 'ei.lock') } +sub resolve_cidxdir ($) { resolve_any_idxdir($_[0], 'cidx.lock') } sub resolve_inboxdir { my ($cd, $ver) = @_; @@ -97,12 +98,22 @@ sub resolve_inboxes ($;$$) { $cfg or die "--all specified, but $cfgfile not readable\n"; @$argv and die "--all specified, but directories specified\n"; } - my (@old, @ibxs, @eidx); + my (@old, @ibxs, @eidx, @cidx); + if ($opt->{-cidx_ok}) { + require PublicInbox::CodeSearchIdx; + @$argv = grep { + if (defined(my $d = resolve_cidxdir($_))) { + push @cidx, PublicInbox::CodeSearchIdx->new( + $d, $opt); + undef; + } else { + 1; + } + } @$argv; + } if ($opt->{-eidx_ok}) { require PublicInbox::ExtSearchIdx; - my $i = -1; @$argv = grep { - $i++; if (defined(my $ei = resolve_eidxdir($_))) { $ei = PublicInbox::ExtSearchIdx->new($ei, $opt); push @eidx, $ei; @@ -124,6 +135,7 @@ sub resolve_inboxes ($;$$) { warn "W: $ibx->{name} $ibx->{inboxdir}: $!\n"; } }); + # TODO: no way to configure cindex in config file, yet } else { # directories specified on the command-line my @dirs = @$argv; push @dirs, '.' if !@dirs && $opt->{-use_cwd}; @@ -164,7 +176,8 @@ sub resolve_inboxes ($;$$) { die "-V$min_ver inboxes not supported by $0\n\t", join("\n\t", @old), "\n"; } - $opt->{-eidx_ok} ? (\@ibxs, \@eidx) : @ibxs; + ($opt->{-eidx_ok} || $opt->{-cidx_ok}) ? (\@ibxs, \@eidx, \@cidx) + : @ibxs; } my @base_mod = (); |