]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/Gcf2Client.pm
gcf2: require git dir with OID
[public-inbox.git] / lib / PublicInbox / Gcf2Client.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 # connects public-inbox processes to public-inbox-gcf2(1)
5 package PublicInbox::Gcf2Client;
6 use strict;
7 use parent 'PublicInbox::Git';
8 use PublicInbox::Spawn qw(popen_rd);
9 use IO::Handle ();
10
11 sub new {
12         my ($rdr) = @_;
13         my $self = bless {}, __PACKAGE__;
14         my ($out_r, $out_w);
15         pipe($out_r, $out_w) or $self->fail("pipe failed: $!");
16         $rdr //= {};
17         $rdr->{0} = $out_r;
18         @$self{qw(in pid)} = popen_rd(['public-inbox-gcf2'], undef, $rdr);
19         $self->{inflight} = [];
20         $self->{out} = $out_w;
21         fcntl($out_w, 1031, 4096) if $^O eq 'linux'; # 1031: F_SETPIPE_SZ
22         $out_w->autoflush(1);
23         $self;
24 }
25
26 # always false, since -gcf2 retries internally
27 sub alternates_changed {}
28
29 1;