If libgit2 development files are installed and L<Inline::C>
is enabled (described above), per-inbox C<git cat-file --batch>
processes are replaced with a single L<perl(1)> process running
-C<PublicInbox::Gcf2::loop> in read-only daemons. libgit2 use
+C<PublicInbox::Lg2::gcf2_loop> in read-only daemons. libgit2 use
will be available in public-inbox 1.7.0+
More (optional) L<Inline::C> use will be introduced in the future
lib/PublicInbox/Filter/RubyLang.pm
lib/PublicInbox/Filter/SubjectTag.pm
lib/PublicInbox/Filter/Vger.pm
-lib/PublicInbox/Gcf2.pm
lib/PublicInbox/Gcf2Client.pm
lib/PublicInbox/GetlineResponse.pm
lib/PublicInbox/Git.pm
lib/PublicInbox/LeiViewText.pm
lib/PublicInbox/LeiWatch.pm
lib/PublicInbox/LeiXSearch.pm
+lib/PublicInbox/Lg2.pm
lib/PublicInbox/Limiter.pm
lib/PublicInbox/Linkify.pm
lib/PublicInbox/Listener.pm
lib/PublicInbox/Xapcmd.pm
lib/PublicInbox/XhcMset.pm
lib/PublicInbox/XhcMsetIterator.pm
-lib/PublicInbox/gcf2_libgit2.h
lib/PublicInbox/khashl.h
+lib/PublicInbox/lg2.h
lib/PublicInbox/xap_helper.h
lib/PublicInbox/xh_cidx.h
lib/PublicInbox/xh_mset.h
# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-# connects public-inbox processes to PublicInbox::Gcf2::loop()
+# connects public-inbox processes to PublicInbox::Lg2::gcf2_loop()
package PublicInbox::Gcf2Client;
use v5.12;
use parent qw(PublicInbox::DS);
use PublicInbox::Git;
-use PublicInbox::Gcf2; # fails if Inline::C or libgit2-dev isn't available
+use PublicInbox::Lg2; # fails if Inline::C or libgit2-dev isn't available
use PublicInbox::Spawn qw(spawn);
use Socket qw(AF_UNIX SOCK_STREAM);
use PublicInbox::Syscall qw(EPOLLIN);
use autodie qw(socketpair);
# fields:
-# sock => socket to Gcf2::loop
+# sock => socket to Lg2::gcf2_loop
# The rest of these fields are compatible with what PublicInbox::Git
# uses code-sharing
-# pid => PID of Gcf2::loop process
+# pid => PID of Lg2::gcf2_loop process
# pid.owner => process which spawned {pid}
# in => same as {sock}, for compatibility with PublicInbox::Git
# inflight => array (see PublicInbox::Git)
$s1->blocking(0);
$opt->{0} = $opt->{1} = $s2;
my $cmd = [$^X, $^W ? ('-w') : (),
- qw[-MPublicInbox::Gcf2 -e PublicInbox::Gcf2::loop]];
+ qw[-MPublicInbox::Lg2 -e PublicInbox::Lg2::gcf2_loop]];
$self->{inflight} = [];
PublicInbox::IO::attach_pid($s1, spawn($cmd, $env, $opt),
\&PublicInbox::Git::gcf_drain, $self->{inflight});
# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-# backend for a git-cat-file-workalike based on libgit2,
-# other libgit2 stuff may go here, too.
-package PublicInbox::Gcf2;
+# including backend for a git-cat-file-workalike based on libgit2,
+package PublicInbox::Lg2;
use v5.12;
use PublicInbox::Spawn qw(which run_qx); # may set PERL_INLINE_DIRECTORY
use Fcntl qw(SEEK_SET);
die "E: libgit2 not installed: $err\n" if $?;
$vals->{$k} = $val;
}
- my $f = "$dir/gcf2_libgit2.h";
+ my $f = "$dir/lg2.h";
$c_src = PublicInbox::IO::try_cat $f or die "cat $f: $!";
# append pkg-config results to the source to ensure Inline::C
# can rebuild if there's changes (it doesn't seem to detect
seek($fh, 0, SEEK_SET);
my @msg = <$fh>;
truncate($fh, 0);
- die "Inline::C Gcf2 build failed:\n", $err, "\n", @msg;
+ die "Inline::C Lg2 build failed:\n", $err, "\n", @msg;
}
}
1;
}
-# Usage: $^X -MPublicInbox::Gcf2 -e PublicInbox::Gcf2::loop [EXPIRE-TIMEOUT]
+# Usage: $^X -MPublicInbox::Lg2 -e PublicInbox::Lg2::gcf2_loop [EXPIRE-TIMEOUT]
# (see lib/PublicInbox/Gcf2Client.pm)
-sub loop (;$) {
+sub gcf2_loop (;$) {
my $exp = $_[0] || $ARGV[0] || 60; # seconds
my $gcf2 = new();
my (%seen, $check_at);
if (my $short = $rmap_inc{$full}) {
return $short;
} elsif (!scalar(keys %rmap_inc) && -e $full) {
- # n.b. $INC{'PublicInbox::Gcf2'} is undef if libgit2-dev
+ # n.b. $INC{'PublicInbox::Lg2'} is undef if libgit2-dev
# doesn't exist
my $f;
%rmap_inc = map {;
$all_libc = undef;
}
}
- if (defined $all_libc) { # set for Gcf2
+ if (defined $all_libc) { # set for Lg2
$ENV{PERL_INLINE_DIRECTORY} = $inline_dir;
%RLIMITS = rlimit_map();
*send_cmd4 = sub ($$$$;$) {
eval "require $mod";
}
if ($@) {
- diag "require $mod: $@" if $mod =~ /Gcf2/;
+ diag "require $mod: $@" if $mod =~ /Lg2/;
push @need, $mod;
} elsif ($mod eq 'IO::Socket::SSL' &&
# old versions of IO::Socket::SSL aren't supported
sub do_cat_async {
my ($arg, $cb, @req) = @_;
- # favor git(1) over Gcf2 (libgit2) for SHA-256 support
+ # favor git(1) over Lg2 (libgit2) for SHA-256 support
my $ctx = ref $arg eq 'ARRAY' ? $arg->[0] : $arg;
$ctx->{git}->cat_async($_, $cb, $arg) for @req;
if ($ctx->{env}->{'pi-httpd.async'}) {
ref = newSViv((IV)odb);
self = newRV_noinc(ref);
- sv_bless(self, gv_stashpv("PublicInbox::Gcf2", GV_ADD));
+ sv_bless(self, gv_stashpv("PublicInbox::Lg2", GV_ADD));
SvREADONLY_on(ref);
return self;
use IO::Handle ();
use POSIX qw(_exit);
use Cwd qw(abs_path);
-require_mods('PublicInbox::Gcf2');
-use_ok 'PublicInbox::Gcf2';
+require_mods('PublicInbox::Lg2');
+use_ok 'PublicInbox::Lg2';
use PublicInbox::Syscall qw($F_SETPIPE_SZ);
use PublicInbox::Import;
my ($tmpdir, $for_destroy) = tmpdir();
-my $gcf2 = PublicInbox::Gcf2::new();
-is(ref($gcf2), 'PublicInbox::Gcf2', '::new works');
+my $gcf2 = PublicInbox::Lg2::new();
+is(ref($gcf2), 'PublicInbox::Lg2', '::new works');
my $COPYING = 'dba13ed2ddf783ee8118c6a581dbf75305f816a3';
open my $agpl, '<', 'COPYING' or BAIL_OUT "AGPL-3 missing: $!";
$agpl = do { local $/; <$agpl> };
ok($gcf2->cat_oid(fileno($fh), $COPYING), 'cat_oid normal');
$ck_copying->('regular file');
- $gcf2 = PublicInbox::Gcf2::new();
+ $gcf2 = PublicInbox::Lg2::new();
$gcf2->add_alternate("$tmpdir/objects");
open $fh, '+>', undef or BAIL_OUT "open: $!";
ok($gcf2->cat_oid(fileno($fh), $COPYING), 'cat_oid alternate');
close $r;
my $broken = fileno($w);
for (1..$nr) {
- my $obj = PublicInbox::Gcf2::new();
+ my $obj = PublicInbox::Lg2::new();
if (defined($objdir)) {
$obj->add_alternate($objdir);
for (1..$cat) {
use PublicInbox::Import;
use PublicInbox::DS;
-require_mods('PublicInbox::Gcf2');
+require_mods('PublicInbox::Lg2');
use_ok 'PublicInbox::Gcf2Client';
my ($tmpdir, $for_destroy) = tmpdir();
my $git_a = "$tmpdir/a.git";