Index

Messaging Server maintains an index entry in memory. A copy of the index entry of all message types is stored in the SQL database, so that it can be restored in the event of a system reset or Messaging Server failure.

Some fields only apply to particular types of entry (such as messages or services); other fields can be interpreted differently for different entry types.

Operating with the SQL database

The SQL database is used to store each TMsvEntry (index entry) as a row of an SQL table in the SQL database. It caches entries, and maintains the most recently accessed entries in the RAM. Entries are cached in the RAM, and are loaded only when required. The RAM usage is controlled by emptying the oldest entry in the cache when it is full. For more information on caching, see Caching . The following illustration shows the architecture of the Message Server with the SQL database.

Figure 1. Message Server architecture with the SQL database
Note: Write operations like updating, creating and deleting entries require disk operation to retrieve TMsvEntry from database, because the entry cache is always in synchronisation with the corresponding entry in the database.

Advantages

The following are the advantages of using the SQL database to store index entries:

  • Reduces the amount of RAM used by messaging, as the message the index file is not used.

  • Enables more messages to be stored on the device, as the number of messages stored is not restricted to the amount of RAM available to store the message index file.

  • Enables controlled usage of RAM, as index entries are loaded on a need basis.

  • Eliminates the possibility of the message index file getting damaged and messages stored on the device getting deleted.

  • Provides advanced search and sort capabilities for searching messages.

  • Accesses and manages message entries on one or more drives at the same time.

Index fields

The following information is stored for each index entry. Some fields only apply to particular types of entry, such as, messages or services; other fields can be interpreted differently for different entry types.

Attachment flag

Indicates that the message has an attachment

BIO

BIO message type

Complete flag

Indicates that the message is complete (for example download has completed.

Connected flag

For a service: indicates whether it is currently connected to a remote server

Deleted flag

Indicates that the entry has been deleted. The entry is not removed until any PC synchronisation tools have been informed of the deletion.

Description

A text string, usually giving the subject of the message

Details

A text string, as follows:

Message: For received messages, this is the sender; for outgoing messages, it is the recipient

Attachment: The name of the attachment

Folder: The name of the folder

Service: The name of the service

Error

A system-wide or MTM-specific error code

Flag

Use

Failed flag

For an outgoing message: indicates that sending failed

Identifier

An integer that uniquely identifies the entry in the Index

In preparation

Entry deleted if server restarts

MTM

A unique identifier specifying the MTM associated with the entry

MTM Data

Three integer fields for MTM-specific use

Multiple Recipients flag

Indicates the message has multiple recipients that require separate transmissions (for example, a fax going to two people)

New flag

Indicates a new message in a folder

Owner flag

Indicates that the entry owns other entries (that it is a parent)

Parent

An integer giving the identifier of the entry’s parent

Priority

An integer giving the message priority

Read flag

Indicates that a message has been read

Read Only flag

Indicates that the entry is read-only

Related folder

The identifier of a target folder for copying or moving entries

Sending state

Describes the state the message is in, for example "Sending", "Failed" and "Sent"

Service

The identifier of the service by which the message is to be sent or from which it was received

Size

An integer giving the size of the message

Standard Folder flag

Identifies standard folders so that they can be properly sorted and stops them being changed/deleted

Time

The time when the message was last edited, sent, or received. Includes date.

Type

A unique identifier giving the type (service, folder, message, and attachment) of the entry

Visibility flag

Indicates the intended visibility of the entry to users of message client applications