|
|
|
NOTE: This Design document is subject to change at any time. |
The zMessageStore object maintains the storage and retrieval of Message objects. This is probably the most complicated object used in eMobius. This object inherits from and implements the zStore interface.
Generically, a Message Store is responsible for the access to Message objects. Messages live in a Message Store. Usually a message only physically exists in a single message store, although messages can certainly be moved and copied between various Stores. In fact, one Store might act as a cache for another store.
The Message ID property is the key property for accessing messages in the Message Store and should be unique within a specific Store.
The Cache property allows for the implementation of common caching or storage schemes. Typically, when a message is retrieved from a Store, it is first retrieved from the Cache. Only if the cache returns a null message does the current store take other action to retrieve the message.
For example, if a MessageStore implements some sort of remote server message system, such as an IMAP email server, the Cache might point to a SQL database or local file store. If a message is not in the local file store, only then is it retrieved from the remote server.
By making the Cache a setable property of the MessageStore, end users can decide how they want messages to be cached locally, or whether they use some sort of remote database. Because each MessageStore has it's own Cache property, you can provide several levels of indirection. For example, the IMAPStore might have an SQLStore as it's cache, and the SQLStore might have a FileStore as its cache. So, when you retrieve a message, it is passed down the chain and first located within the local FileStore. If the message is not found in the FileStore, then it is located within the SQLStore. If the message is not found within the SQLStore, then the IMAPStore finally retrieves it from the remote IMAP Server. This mechanism is the key to the flexibility of Message Stores.
A message store might also contain "mailboxes." Mailboxes are similar to folders and provide a hierarchy within the store. For example, in a FileStore, a directory containing message files would be considered a "mailbox." Message Stores that use mailboxes should implement the separate zFolderStore interface.
It is the responsibility of the message store to generate unique message ID string values for each message in the store. This ID field must contain all of the information needed to fetch the message from the store. eMobius will add the ID of the message store to the beginning of a message ID when storing it elsewhere so that it knows what message store is responsible for managing the message. But this information is stripped before it is passed back to a message store. So, a message store is free to implement its own algorithm for generating message ID values. |
|