about summary refs log tree commit homepage
path: root/lib/PublicInbox/Inbox.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-03 20:03:55 +0000
committerEric Wong <e@80x24.org>2022-08-04 07:00:58 +0000
commit213e03e1f9624faa4a3a9813f1eac5035c1eb62a (patch)
tree070e38ebf61c4d1f62779f9e451cffef47442835 /lib/PublicInbox/Inbox.pm
parent63dce18973d63837efd89225085fe144a8954bdf (diff)
downloadpublic-inbox-213e03e1f9624faa4a3a9813f1eac5035c1eb62a.tar.gz
This will be used to speed up NNTP group listings and IMAP startup
with thousands of inboxes.
Diffstat (limited to 'lib/PublicInbox/Inbox.pm')
-rw-r--r--lib/PublicInbox/Inbox.pm10
1 files changed, 10 insertions, 0 deletions
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};