[Dovecot] Quota plugin

Timo Sirainen tss at iki.fi
Tue Jun 22 11:16:44 EEST 2004


On Mon, 2004-06-21 at 21:00, Timo Sirainen wrote:
> I've updated the proxy plugin at 
> http://dovecot.org/patches/1.0/quota.c.

Eeh.. Quota plugin, of course. I mixed up quota and proxy words way too
much yesterday when I had to modify both the class proxying code which
enables writing plugins more easily as well as the quota plugin.

Today with latest CVS code the latest quota plugin fully works with
mbox.

Except.. I think the logic needs some more thinking. When exactly is the
quota updated? Is it our responsibility to update quota for changes made
by others then Dovecot? Currently it updates only it's own changes.

Maybe it would be better to implement like:

1. Hook into save/copy commands

Decrease quota_left internally for each mail, if it ever would become
negative, fail the save/copy command. when the whole transaction is
complete, update the quota backend.

2. Hook into syncing

For each external newly appeared mail, increase the quota (our save/copy
hook already updated it for internally created mails).

For each internal or external expunge, decrease the quota.

If we don't know expunged mail's size anymore (external expunge and we
hadn't cached it's size), we need to recalculate quota. Stop calculating
quota for the rest of the syncing session, and at the end do the
recalculating by summing size of all existing messages.

Currently it's not possible to hook into syncing, I have to think how
that'd work.. It would probably need to hook between index <-> storage
syncing, not between client <-> storage. Although the latter would work,
the actual message has always been deleted at that point and there's
less chance of getting it's size.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://dovecot.org/pipermail/dovecot/attachments/20040622/3517dd7c/attachment-0001.bin>


More information about the dovecot mailing list