1 # Copyright (C) 2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # front-end for the "lei index" sub-command, this is similar to
5 # "lei import" but doesn't put a git blob into ~/.local/share/lei/store
6 package PublicInbox::LeiIndex;
9 use parent qw(PublicInbox::IPC PublicInbox::LeiInput);
10 use PublicInbox::LeiImport;
12 # /^input_/ subs are used by (or override) PublicInbox::LeiInput superclass
13 sub input_eml_cb { # used by input_maildir_cb and input_net_cb
14 my ($self, $eml, $vmd) = @_;
15 my $xoids = $self->{lei}->{ale}->xoids_for($eml);
16 if (my $all_vmd = $self->{all_vmd}) {
17 @$vmd{keys %$all_vmd} = values %$all_vmd;
19 $self->{lei}->{sto}->wq_do('index_eml_only', $eml, $vmd, $xoids);
22 sub input_fh { # overrides PublicInbox::LeiInput::input_fh
23 my ($self, $ifmt, $fh, $input, @args) = @_;
24 $self->{lei}->child_error(0, <<EOM);
25 $input ($ifmt) not yet supported, try `lei import'
30 my ($lei, @argv) = @_;
31 $lei->{opt}->{'mail-sync'} = 1;
32 my $self = bless {}, __PACKAGE__;
33 PublicInbox::LeiImport::do_import_index($self, $lei, @argv);
38 for my $m (qw(pmdir_cb input_net_cb)) {
39 *$m = PublicInbox::LeiImport->can($m);
42 *_complete_index = \&PublicInbox::LeiImport::_complete_import;
43 *ipc_atfork_child = \&PublicInbox::LeiInput::input_only_atfork_child;
44 *net_merge_all_done = \&PublicInbox::LeiInput::input_only_net_merge_all_done;