-2

What is the design reason for uniquely identifying mail on a folder by folder basis rather than on a server wide basis?

IMAP specifies that mail is uniquely identified by a folder name, a UIDValidity (32bits) and a UID(32bits). Why not just uniquely identify mail server wide by a single 64bit UID?

Dom
  • 37
  • 3
  • IMAP was originally designed in 1986. While it has been revised a few times, many of the design decisions are historical (the latest revision dates from the 1990s) and you'd have to ask the original participants *why* they made the choices they did. There was less prior art and fewer bits in our processors at the time, which may have something to do with it. – larsks Feb 02 '23 at 13:43
  • Indeed, the "whys" of design decisions in old well-established protocols have a tendency to be a problematic entry point of questions from a practical point of view; the "whys" are often not as clearly documented and they have a tendency to be kind of pointless in practice (you generally have no choice, the protocol is what it is) unless they help you understand the "whats" and the "hows" better, but then the "whats" and "hows" are often better asked about more directly. – Håkan Lindqvist Feb 02 '23 at 14:07
  • @HåkanLindqvist I am trying to understand the protocol more thoroughly and the separation of UIDs and UIDValidity seems pretty fundamental to how it works. I'd actually assumed it was a very simple question with a really obvious answer, maybe something to do with being able to easily identify mail which had been added or removed. I was hoping that someone with a good knowledge of the protocol might be able to pop down the reason. – Dom Feb 02 '23 at 14:29
  • @Dom That is kind of the point I was trying to get at; I think it's much easier to explain how UID, UIDVALIDITY, etc work together than it is to explain why it was designed in a mailbox-scoped way instead of having a global id scope. – Håkan Lindqvist Feb 02 '23 at 14:34

1 Answers1

0

Largely ignoring the question of why it was designed this way, here is an explanation of how UID and UIDVALIDITY work together in IMAP:

The UID is a unique identifier assigned to each message, scoped to the specific "mailbox".

The "mailbox" in the context of UID handling is effectively identified by the combination of:

  1. The mailbox name (eg: INBOX)
  2. The UIDVALIDITY value (suggested implementation: creation date of the mailbox)
    This is essentially a cache-management mechanism, such that a new mailbox with a name that has existed before does not confuse a client that had also seen the old mailbox by that name (such that an IMAP server implementation is not forced to retain UID state of deleted mailboxes)
Håkan Lindqvist
  • 35,011
  • 5
  • 69
  • 94