From 213e03e1f9624faa4a3a9813f1eac5035c1eb62a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 3 Aug 2022 20:03:55 +0000 Subject: miscidx: index inbox min/max article numbers This will be used to speed up NNTP group listings and IMAP startup with thousands of inboxes. --- lib/PublicInbox/Inbox.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/PublicInbox/Inbox.pm') diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index 0ad68810..3f70e69d 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -409,6 +409,16 @@ sub uidvalidity { $_[0]->{uidvalidity} //= eval { $_[0]->mm->created_at } } sub eidx_key { $_[0]->{newsgroup} // $_[0]->{inboxdir} } +# only used by NNTP, so we need ->mm anyways +sub art_min { $_[0]->{-art_min} //= eval { $_[0]->mm(1)->min } } + +# used by IMAP, too, which tries to avoid ->mm (but ->{mm} is likely +# faster since it's smaller iff available) +sub art_max { + $_[0]->{-art_max} //= eval { $_[0]->{mm}->max } // + eval { $_[0]->over(1)->max }; +} + sub mailboxid { # rfc 8474, 8620, 8621 my ($self, $imap_slice) = @_; my $pfx = defined($imap_slice) ? $self->{newsgroup} : $self->{name}; -- cgit v1.2.3-24-ge0c7