]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/ExtSearch.pm
extsearch: start mocking out
[public-inbox.git] / lib / PublicInbox / ExtSearch.pm
1 # Copyright (C) 2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3
4 # Read-only external (detached) index for cross inbox search.
5 # This is a read-only counterpart to PublicInbox::ExtSearchIdx
6 package PublicInbox::ExtSearch;
7 use strict;
8 use v5.10.1;
9 use PublicInbox::Over;
10
11 # for ->reopen, ->mset, ->mset_to_artnums
12 use parent qw(PublicInbox::Search);
13
14 sub new {
15         my (undef, $topdir) = @_;
16         bless {
17                 topdir => $topdir,
18                 # xpfx => 'ei15'
19                 xpfx => "$topdir/ei".PublicInbox::Search::SCHEMA_VERSION
20         }, __PACKAGE__;
21 }
22
23 # overrides PublicInbox::Search::_xdb
24 sub _xdb {
25         my ($self) = @_;
26         $self->_xdb_sharded($self->{xpfx});
27 }
28
29 # same as per-inbox ->over, for now...
30 sub over {
31         my ($self) = @_;
32         $self->{over} //= PublicInbox::Over->new("$self->{xpfx}/over.sqlite3");
33 }
34
35 sub git {
36         my ($self) = @_;
37         $self->{git} //= PublicInbox::Git->new("$self->{topdir}/ALL.git");
38 }
39
40 1;