Sam writes:
> On Sat, 14 Aug 1999, David Harris wrote:
>
> > This is the way to do it. I'm concerned that the IMAP Maildir driver does not
> > store any kind of database like this, so it has to scan all of the files to
> > produce summary information. The method you are taking of storing a helper
> > index is the way to go. Any chance you'd be interested in working your code
> > into the IMAP Maildir driver code?
>
> I don't use IMAP and I've looked inside c-client only briefly, on a couple
> of occasions. Currently, it scales to about a 1,000 messages per folder
> or INBOX, before it starts to slow down and eat memory. This is
> reasonable for a webmail CGI, but for full mail services, you'll need to
> scale into hundreds of thousands of messages. I'm considering either
> fixed length records, or GDBM or DB-based indexes.
I've had good success rebuilding a CDB into another CDB. It's *very* quick.
#!/usr/bin/perl
# given a list of email addresses, remove them from our database.
use Fcntl; # for O_ constants
# put all of stdin into a hash.
while(<>) { chomp; $in{$_} = ""; }
open(DB_FH, "+>db.lock") || die "dup $!";
unless (flock (DB_FH, 2)) { die "flock: $!" } # LOCK_EX
open(DBO, "|cdbmake data/db.cdb data/db.$$") or die "cdbmake: $!\n";
open(DBI, "cdbdump <data/db.cdb|") or die "cdbdump: $!\n";
while(<DBI>) {
next if (($length) = m/^\+(\d+),\d+:/) && exists($in{substr($', 0, $length)});
print DBO;
}
close(DBI) or die "cdbdump close: $!\n";
close(DBO) or die "cdbmake close: $!\n";
flock(DB_FH, 8); # LOCK_UN
close(DB_FH);
--
-russ nelson <[EMAIL PROTECTED]> http://russnelson.com
Crynwr sells support for free software | PGPok | Government schools are so
521 Pleasant Valley Rd. | +1 315 268 1925 voice | bad that any rank amateur
Potsdam, NY 13676-3213 | +1 315 268 9201 FAX | can outdo them. Homeschool!