summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
73b40ff)
lib/PublicInbox/KQNotify.pm
lib/PublicInbox/LEI.pm
lib/PublicInbox/LeiDedupe.pm
lib/PublicInbox/KQNotify.pm
lib/PublicInbox/LEI.pm
lib/PublicInbox/LeiDedupe.pm
-lib/PublicInbox/LeiExtinbox.pm
+lib/PublicInbox/LeiExternal.pm
lib/PublicInbox/LeiSearch.pm
lib/PublicInbox/LeiStore.pm
lib/PublicInbox/LeiToMail.pm
lib/PublicInbox/LeiSearch.pm
lib/PublicInbox/LeiStore.pm
lib/PublicInbox/LeiToMail.pm
package PublicInbox::LEI;
use strict;
use v5.10.1;
package PublicInbox::LEI;
use strict;
use v5.10.1;
-use parent qw(PublicInbox::DS PublicInbox::LeiExtinbox);
+use parent qw(PublicInbox::DS PublicInbox::LeiExternal);
use Getopt::Long ();
use Socket qw(AF_UNIX SOCK_STREAM pack_sockaddr_un);
use Errno qw(EAGAIN ECONNREFUSED ENOENT);
use Getopt::Long ();
use Socket qw(AF_UNIX SOCK_STREAM pack_sockaddr_un);
use Errno qw(EAGAIN ECONNREFUSED ENOENT);
our %CMD = ( # sorted in order of importance/use:
'q' => [ 'SEARCH_TERMS...', 'search for messages matching terms', qw(
save-as=s output|o=s format|f=s dedupe|d=s thread|t augment|a
our %CMD = ( # sorted in order of importance/use:
'q' => [ 'SEARCH_TERMS...', 'search for messages matching terms', qw(
save-as=s output|o=s format|f=s dedupe|d=s thread|t augment|a
- sort|s=s@ reverse|r offset=i remote local! extinbox!
+ sort|s=s@ reverse|r offset=i remote local! external!
since|after=s until|before=s), opt_dash('limit|n=i', '[0-9]+') ],
'show' => [ 'MID|OID', 'show a given object (Message-ID or object ID)',
qw(type=s solve! format|f=s dedupe|d=s thread|t remote local!),
pass_through('git show') ],
since|after=s until|before=s), opt_dash('limit|n=i', '[0-9]+') ],
'show' => [ 'MID|OID', 'show a given object (Message-ID or object ID)',
qw(type=s solve! format|f=s dedupe|d=s thread|t remote local!),
pass_through('git show') ],
-'add-extinbox' => [ 'URL_OR_PATHNAME',
+'add-external' => [ 'URL_OR_PATHNAME',
'add/set priority of a publicinbox|extindex for extra matches',
qw(boost=i quiet|q) ],
'add/set priority of a publicinbox|extindex for extra matches',
qw(boost=i quiet|q) ],
-'ls-extinbox' => [ '[FILTER...]', 'list publicinbox|extindex locations',
+'ls-external' => [ '[FILTER...]', 'list publicinbox|extindex locations',
qw(format|f=s z|0 local remote quiet|q) ],
qw(format|f=s z|0 local remote quiet|q) ],
-'forget-extinbox' => [ '{URL_OR_PATHNAME|--prune}',
+'forget-external' => [ '{URL_OR_PATHNAME|--prune}',
'exclude further results from a publicinbox|extindex',
qw(prune quiet|q) ],
'exclude further results from a publicinbox|extindex',
qw(prune quiet|q) ],
'q format|f=s' => [ 'OUT|maildir|mboxrd|mboxcl2|mboxcl|html|oid|json',
'specify output format, default depends on --output'],
'ls-query format|f=s' => $ls_format,
'q format|f=s' => [ 'OUT|maildir|mboxrd|mboxcl2|mboxcl|html|oid|json',
'specify output format, default depends on --output'],
'ls-query format|f=s' => $ls_format,
-'ls-extinbox format|f=s' => $ls_format,
+'ls-external format|f=s' => $ls_format,
'limit|n=i@' => ['NUM', 'limit on number of matches (default: 10000)' ],
'offset=i' => ['OFF', 'search result offset (default: 0)'],
'limit|n=i@' => ['NUM', 'limit on number of matches (default: 10000)' ],
'offset=i' => ['OFF', 'search result offset (default: 0)'],
# Copyright (C) 2020 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Copyright (C) 2020 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-# *-extinbox commands of lei
-package PublicInbox::LeiExtinbox;
+# *-external commands of lei
+package PublicInbox::LeiExternal;
use strict;
use v5.10.1;
use parent qw(Exporter);
use strict;
use v5.10.1;
use parent qw(Exporter);
-our @EXPORT = qw(lei_ls_extinbox lei_add_extinbox lei_forget_extinbox);
+our @EXPORT = qw(lei_ls_external lei_add_external lei_forget_external);
my ($self, @argv) = @_;
my $stor = $self->_lei_store(0);
my $cfg = $self->_lei_cfg(0);
my $out = $self->{1};
my ($OFS, $ORS) = $self->{opt}->{z} ? ("\0", "\0\0") : (" ", "\n");
my (%boost, @loc);
my ($self, @argv) = @_;
my $stor = $self->_lei_store(0);
my $cfg = $self->_lei_cfg(0);
my $out = $self->{1};
my ($OFS, $ORS) = $self->{opt}->{z} ? ("\0", "\0\0") : (" ", "\n");
my (%boost, @loc);
- for my $sec (grep(/\Aextinbox\./, @{$cfg->{-section_order}})) {
- my $loc = substr($sec, length('extinbox.'));
+ for my $sec (grep(/\Aexternal\./, @{$cfg->{-section_order}})) {
+ my $loc = substr($sec, length('external.'));
$boost{$loc} = $cfg->{"$sec.boost"};
push @loc, $loc;
}
$boost{$loc} = $cfg->{"$sec.boost"};
push @loc, $loc;
}
my ($self, $url_or_dir) = @_;
my $cfg = $self->_lei_cfg(1);
if ($url_or_dir !~ m!\Ahttps?://!) {
$url_or_dir = File::Spec->canonpath($url_or_dir);
}
my $new_boost = $self->{opt}->{boost} // 0;
my ($self, $url_or_dir) = @_;
my $cfg = $self->_lei_cfg(1);
if ($url_or_dir !~ m!\Ahttps?://!) {
$url_or_dir = File::Spec->canonpath($url_or_dir);
}
my $new_boost = $self->{opt}->{boost} // 0;
- my $key = "extinbox.$url_or_dir.boost";
+ my $key = "external.$url_or_dir.boost";
my $cur_boost = $cfg->{$key};
return if defined($cur_boost) && $cur_boost == $new_boost; # idempotent
$self->lei_config($key, $new_boost);
my $cur_boost = $cfg->{$key};
return if defined($cur_boost) && $cur_boost == $new_boost; # idempotent
$self->lei_config($key, $new_boost);
-sub lei_forget_extinbox {
+sub lei_forget_external {
my ($self, $ibxish) = @_; # ibxish = ExtSearch or Inbox
if (!$ibxish->can('over')) {
push @{$self->{remotes}}, $ibxish
my ($self, $ibxish) = @_; # ibxish = ExtSearch or Inbox
if (!$ibxish->can('over')) {
push @{$self->{remotes}}, $ibxish
$seen || BAIL_OUT 'no imports';
};
$seen || BAIL_OUT 'no imports';
};
-my $test_extinbox = sub {
+my $test_external = sub {
$setup_publicinboxes->();
$cleanup->();
$setup_publicinboxes->();
$cleanup->();
- $lei->('ls-extinbox');
- is($out.$err, '', 'ls-extinbox no output, yet');
+ $lei->('ls-external');
+ is($out.$err, '', 'ls-external no output, yet');
ok(!-e $config_file && !-e $store_dir,
ok(!-e $config_file && !-e $store_dir,
- 'nothing created by ls-extinbox');
+ 'nothing created by ls-external');
my $cfg = PublicInbox::Config->new;
$cfg->each_inbox(sub {
my ($ibx) = @_;
my $cfg = PublicInbox::Config->new;
$cfg->each_inbox(sub {
my ($ibx) = @_;
- ok($lei->(qw(add-extinbox -q), $ibx->{inboxdir}),
- 'added extinbox');
+ ok($lei->(qw(add-external -q), $ibx->{inboxdir}),
+ 'added external');
is($out.$err, '', 'no output');
});
ok(-s $config_file && -e $store_dir,
is($out.$err, '', 'no output');
});
ok(-s $config_file && -e $store_dir,
- 'add-extinbox created config + store');
+ 'add-external created config + store');
my $lcfg = PublicInbox::Config->new($config_file);
$cfg->each_inbox(sub {
my ($ibx) = @_;
my $lcfg = PublicInbox::Config->new($config_file);
$cfg->each_inbox(sub {
my ($ibx) = @_;
- is($lcfg->{"extinbox.$ibx->{inboxdir}.boost"}, 0,
+ is($lcfg->{"external.$ibx->{inboxdir}.boost"}, 0,
"configured boost on $ibx->{name}");
});
"configured boost on $ibx->{name}");
});
- $lei->('ls-extinbox');
- like($out, qr/boost=0\n/s, 'ls-extinbox has output');
+ $lei->('ls-external');
+ like($out, qr/boost=0\n/s, 'ls-external has output');
};
my $test_lei_common = sub {
$test_help->();
$test_config->();
$test_init->();
};
my $test_lei_common = sub {
$test_help->();
$test_config->();
$test_init->();
};
my $test_lei_oneshot = $ENV{TEST_LEI_ONESHOT};
};
my $test_lei_oneshot = $ENV{TEST_LEI_ONESHOT};
my $es = PublicInbox::ExtSearch->new("$home/eidx");
my $lxs = PublicInbox::LeiXSearch->new;
for my $ibxish (shuffle($es, @ibx)) {
my $es = PublicInbox::ExtSearch->new("$home/eidx");
my $lxs = PublicInbox::LeiXSearch->new;
for my $ibxish (shuffle($es, @ibx)) {
- $lxs->attach_extinbox($ibxish);
+ $lxs->attach_external($ibxish);
}
my $nr = $lxs->xdb->get_doccount;
my $mset = $lxs->mset('d:19931002..19931003', { limit => $nr });
}
my $nr = $lxs->xdb->get_doccount;
my $mset = $lxs->mset('d:19931002..19931003', { limit => $nr });