From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 17/36] lei: rename "extinbox" => "external"
Date: Thu, 31 Dec 2020 13:51:35 +0000 [thread overview]
Message-ID: <20201231135154.6070-18-e@80x24.org> (raw)
In-Reply-To: <20201231135154.6070-1-e@80x24.org>
The words "extinbox" and "extindex" are too close and easy to
confuse with the other. Rename "extinbox" to "external", since
these could be IMAP, JMAP or other non-public-inbox search APIs.
Link: https://public-inbox.org/meta/20201226112649.GB6226@dcvr/
---
MANIFEST | 2 +-
lib/PublicInbox/LEI.pm | 12 +++++-----
.../{LeiExtinbox.pm => LeiExternal.pm} | 18 +++++++--------
lib/PublicInbox/LeiXSearch.pm | 2 +-
t/lei.t | 22 +++++++++----------
t/lei_xsearch.t | 2 +-
6 files changed, 29 insertions(+), 29 deletions(-)
rename lib/PublicInbox/{LeiExtinbox.pm => LeiExternal.pm} (75%)
diff --git a/MANIFEST b/MANIFEST
index 96ad52bf..6dc08f01 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -164,7 +164,7 @@ lib/PublicInbox/Isearch.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
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 9aa4d95a..f960aa72 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -8,7 +8,7 @@
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);
@@ -70,19 +70,19 @@ sub _config_path ($) {
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') ],
-'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) ],
-'ls-extinbox' => [ '[FILTER...]', 'list publicinbox|extindex locations',
+'ls-external' => [ '[FILTER...]', 'list publicinbox|extindex locations',
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) ],
@@ -189,7 +189,7 @@ my %OPTDESC = (
'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)'],
diff --git a/lib/PublicInbox/LeiExtinbox.pm b/lib/PublicInbox/LeiExternal.pm
similarity index 75%
rename from lib/PublicInbox/LeiExtinbox.pm
rename to lib/PublicInbox/LeiExternal.pm
index c2de7735..0378551a 100644
--- a/lib/PublicInbox/LeiExtinbox.pm
+++ b/lib/PublicInbox/LeiExternal.pm
@@ -1,22 +1,22 @@
# 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);
-our @EXPORT = qw(lei_ls_extinbox lei_add_extinbox lei_forget_extinbox);
+our @EXPORT = qw(lei_ls_external lei_add_external lei_forget_external);
-sub lei_ls_extinbox {
+sub lei_ls_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);
- 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;
}
@@ -28,14 +28,14 @@ sub lei_ls_extinbox {
}
}
-sub lei_add_extinbox {
+sub lei_add_external {
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);
@@ -44,7 +44,7 @@ sub lei_add_extinbox {
$stor->done;
}
-sub lei_forget_extinbox {
+sub lei_forget_external {
# TODO
}
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 1a81b14a..7d251afd 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -18,7 +18,7 @@ sub new {
}, $class
}
-sub attach_extinbox {
+sub attach_external {
my ($self, $ibxish) = @_; # ibxish = ExtSearch or Inbox
if (!$ibxish->can('over')) {
push @{$self->{remotes}}, $ibxish
diff --git a/t/lei.t b/t/lei.t
index a95a0efc..764a7fe4 100644
--- a/t/lei.t
+++ b/t/lei.t
@@ -154,38 +154,38 @@ my $setup_publicinboxes = sub {
$seen || BAIL_OUT 'no imports';
};
-my $test_extinbox = sub {
+my $test_external = sub {
$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,
- 'nothing created by ls-extinbox');
+ 'nothing created by ls-external');
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,
- 'add-extinbox created config + store');
+ 'add-external created config + store');
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}");
});
- $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->();
- $test_extinbox->();
+ $test_external->();
};
my $test_lei_oneshot = $ENV{TEST_LEI_ONESHOT};
diff --git a/t/lei_xsearch.t b/t/lei_xsearch.t
index c41213bd..178c3d37 100644
--- a/t/lei_xsearch.t
+++ b/t/lei_xsearch.t
@@ -49,7 +49,7 @@ $eidx->eidx_sync({fsync => 0});
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 });
next prev parent reply other threads:[~2020-12-31 13:51 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-31 13:51 [PATCH 00/36] another round of lei stuff Eric Wong
2020-12-31 13:51 ` [PATCH 01/36] import: respect init.defaultBranch Eric Wong
2020-12-31 13:51 ` [PATCH 02/36] lei_store: use per-machine refname as git HEAD Eric Wong
2020-12-31 13:51 ` [PATCH 03/36] revert "lei_store: use per-machine refname as git HEAD" Eric Wong
2020-12-31 13:51 ` [PATCH 04/36] lei_to_mail: initial implementation for writing mbox formats Eric Wong
2020-12-31 13:51 ` [PATCH 05/36] sharedkv: fork()-friendly key-value store Eric Wong
2020-12-31 13:51 ` [PATCH 06/36] sharedkv: split out index_values Eric Wong
2020-12-31 13:51 ` [PATCH 07/36] lei_to_mail: start atomic and compressed mbox writing Eric Wong
2020-12-31 13:51 ` [PATCH 08/36] mboxreader: new class for reading various mbox formats Eric Wong
2020-12-31 13:51 ` [PATCH 09/36] lei_to_mail: start --augment, dedupe, bz2 and xz Eric Wong
2020-12-31 13:51 ` [PATCH 10/36] lei: implement various deduplication strategies Eric Wong
2020-12-31 13:51 ` [PATCH 11/36] lei_to_mail: lazy-require LeiDedupe Eric Wong
2020-12-31 13:51 ` [PATCH 12/36] lei_to_mail: support for non-seekable outputs Eric Wong
2020-12-31 13:51 ` [PATCH 13/36] lei_to_mail: support Maildir, fix+test --augment Eric Wong
2020-12-31 13:51 ` [PATCH 14/36] ipc: generic IPC dispatch based on Storable Eric Wong
2020-12-31 13:51 ` [PATCH 15/36] ipc: support Sereal Eric Wong
2020-12-31 13:51 ` [PATCH 16/36] lei_store: add ->set_eml, ->add_eml can return smsg Eric Wong
2020-12-31 13:51 ` Eric Wong [this message]
2020-12-31 13:51 ` [PATCH 18/36] mid: use defined-or with `push' for uniqueness check Eric Wong
2020-12-31 13:51 ` [PATCH 19/36] mid: hoist out mids_in sub Eric Wong
2020-12-31 13:51 ` [PATCH 20/36] lei_store: handle messages without Message-ID at all Eric Wong
2020-12-31 13:51 ` [PATCH 21/36] ipc: use shutdown(2), base atfork* callback Eric Wong
2020-12-31 13:51 ` [PATCH 22/36] lei_to_mail: unlink mboxes if not augmenting Eric Wong
2020-12-31 13:51 ` [PATCH 23/36] lei: add --mfolder as an --output alias Eric Wong
2020-12-31 13:51 ` [PATCH 24/36] spawn: move run_die here from PublicInbox::Import Eric Wong
2020-12-31 13:51 ` [PATCH 25/36] init: remove embedded UnlinkMe package Eric Wong
2020-12-31 13:51 ` [PATCH 26/36] t/run: avoid uninitialized var on incomplete test Eric Wong
2020-12-31 13:51 ` [PATCH 27/36] gcf2client: reap process on DESTROY Eric Wong
2020-12-31 13:51 ` [PATCH 28/36] lei_to_mail: open FIFOs O_WRONLY so we block Eric Wong
2020-12-31 13:51 ` [PATCH 29/36] searchidxshard: call DS->Reset at worker start Eric Wong
2020-12-31 13:51 ` [PATCH 30/36] t/ipc.t: test for references via `die' Eric Wong
2020-12-31 13:51 ` [PATCH 31/36] use PublicInbox::DS for dwaitpid Eric Wong
2020-12-31 13:51 ` [PATCH 32/36] syscall: SFD_NONBLOCK can be a constant, again Eric Wong
2020-12-31 13:51 ` [PATCH 33/36] lei: avoid Spawn package when starting daemon Eric Wong
2020-12-31 13:51 ` [PATCH 34/36] avoid calling waitpid from children in DESTROY Eric Wong
2020-12-31 13:51 ` [PATCH 35/36] ds: clobber $in_loop first at reset Eric Wong
2020-12-31 13:51 ` [PATCH 36/36] on_destroy: support PID owner guard Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201231135154.6070-18-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).