user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
eb2ecf2f237077613be48e5ecbbee1d347b93c13 blob 1474 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
 
# Copyright (C) 2020 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>

# temporary queue for public-inbox-index to support multi-Message-ID
# messages on mirrors of v2 inboxes
package PublicInbox::MultiMidQueue;
use strict;
use SDBM_File; # part of Perl standard library
use Fcntl qw(O_RDWR O_CREAT);
use File::Temp 0.19 (); # 0.19 for ->newdir
my %e = (
	freebsd => 0x100000,
	linux => 0x80000,
	netbsd => 0x400000,
	openbsd => 0x10000,
);
my $O_CLOEXEC = $e{$^O} // 0;

sub new {
	my ($class) = @_;
	my $tmpdir = File::Temp->newdir('multi-mid-q-XXXXXX', TMPDIR => 1);
	my $base = $tmpdir->dirname . '/q';
	my %sdbm;
	my $flags = O_RDWR|O_CREAT;
	if (!tie(%sdbm, 'SDBM_File', $base, $flags|$O_CLOEXEC, 0600)) {
		if (!tie(%sdbm, 'SDBM_File', $base, $flags, 0600)) {
			die "could not tie ($base): $!";
		}
		$O_CLOEXEC = 0;
	}

	bless {
		cur => 1,
		min => 1,
		max => 0,
		sdbm => \%sdbm,
		tmpdir => $tmpdir,
	}, $class;
}

sub set_oid {
	my ($self, $i, $oid, $v2w) = @_;
	$self->{max} = $i if $i > $self->{max};
	$self->{min} = $i if $i < $self->{min};
	$self->{sdbm}->{$i} = "$oid\t$v2w->{autime}\t$v2w->{cotime}";
}

sub get_oid {
	my ($self, $i, $v2w) = @_;
	my $rec = $self->{sdbm}->{$i} or return;
	my ($oid, $autime, $cotime) = split(/\t/, $rec);
	$v2w->{autime} = $autime;
	$v2w->{cotime} = $cotime;
	$oid
}

sub push_oid {
	my ($self, $oid, $v2w) = @_;
	set_oid($self, $self->{cur}++, $oid, $v2w);
}

1;
debug log:

solving eb2ecf2f2 ...
found eb2ecf2f2 in public-inbox.git

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.mail.public-inbox.meta
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.mail.public-inbox.meta
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git