go-imap
go-imap copied to clipboard
Add Mailbox.Close
I am working on the maildir-based backend that uses BoltDB for caches and metadata. BoltDB DB is created per mailbox. backend.Mailbox implementation opens it on demand, but it also needs to close it at some point. Currently Close() is missing for Mailbox so I cannot do it.
Proposal: If Mailbox implements io.Closer, call Close() after use. Not sure about ListMailboxes.
Since BoltDB only supports one consumer at a time, you'll want to refcount mailboxes.
Maybe go-imap v2 should make ListMailboxes return a []MailboxInfo instead of a []Mailbox.
For v1 I think Close should be called for mailboxes returned by ListMailboxes too.
Fixed in go-imap v2.