mail-index.h revision 26ff8f8a4867bf8e9551a27a2de8c12cd138b065
/* these UIDs may not exist and may not even be unseen */ /* We have internal and external sync offsets. External changes are synced into index somewhat more often, so int_offset <= ext_offset */ /* daily first UIDs that have been added to index. */ uint8_t flags;
/* enum mail_flags | enum mail_index_mail_flags */ /* MAIL_INDEX_SYNC_TYPE_FLAGS: */ /* MAIL_INDEX_SYNC_TYPE_KEYWORDS: */ /* Refresh index so mail_index_lookup*() will return latest values. Note that immediately after this call there may already be changes, so if you need to rely on validity of the returned values, use some external locking for it. */ /* View can be used to look into index. Sequence numbers inside view change only when you synchronize it. The view acquires required locks automatically, but you'll have to drop them manually. */ /* Returns the index for given view. */ /* Call whenever you've done with requesting messages from view for a while. */ /* Returns number of mails in view. */ /* Returns TRUE if we lost track of changes for some reason. */ /* Transaction has to be opened to be able to modify index. You can have multiple transactions open simultaneously. Note that committed transactions won't show up until you've synchronized mailbox (mail_index_sync_begin). */ /* Returns a view to transaction. Currently this differs from normal view only in that it contains newly appended messages in transaction. The view can still be used after transaction has been committed. */ /* Begin synchronizing mailbox with index file. This call locks the index exclusively against other modifications. Returns 1 if ok, -1 if error. If log_file_seq is not (uint32_t)-1 and index is already synchronized up to given log_file_offset, the synchronization isn't started and this function returns 0. This should be done when you wish to sync your previous transaction instead of doing a full mailbox synchronization. mail_index_sync_next() returns all changes from previously committed transactions which haven't yet been committed to the actual mailbox. They're returned in ascending order and they never overlap (if we add more sync types, then they might). You must go through all of them and update None of the changes actually show up in index until after successful mail_index_sync_commit(). Returned sequence numbers describe the mailbox state at the beginning of synchronization, ie. expunges don't affect them. You may create a new transaction for the returned view. That transaction acts as "external mailbox changes" transaction. Any changes done there are expected to describe mailbox's current state. */ /* Returns -1 if error, 0 if sync is finished, 1 if record was filled. */ /* Returns 1 if there's more to sync, 0 if not. */ /* Commit synchronization by writing all changes to mail index file. */ /* Rollback synchronization - none of the changes listed by sync_next() are actually written to index file. */ /* Mark index file corrupted. Invalidates all views. */ /* Check and fix any found problems. If index is broken beyond repair, it's marked corrupted and 0 is returned. Otherwise returns -1 if there was some I/O error or 1 if everything went ok. */ /* Synchronize changes in view. You have to go through all records, or view will be marked inconsistent. Only sync_mask type records are /* Returns -1 if error, 0 if sync is finished, 1 if record was filled. */ /* Returns the index header. */ /* Returns the given message. Returns -1 if error, 1 if ok, 0 if mail was expunged but data was returned from some older index. */ /* Returns the UID for given message. May be slightly faster than mail_index_lookup()->uid. */ /* Convert UID range to sequence range. If no UIDs are found, sequences are set to 0. Note that any of the returned sequences may have been expunged /* Find first mail with (mail->flags & flags_mask) == flags. Useful mostly for taking advantage of lowwater-fields in headers. */ /* Append a new record to index. */ /* Assigns UIDs for appended mails all at once. UID must have been given as 0 for mail_index_append(). Returns the next unused UID. */ /* Expunge record from index. Note that this doesn't affect sequence numbers until transaction is committed and mailbox is synced. */ /* Update flags in index. */ /* Return a list of all existing keywords, or NULL if there is none. */ /* Create a keyword list structure. It's freed automatically at the end of /* Update keywords for given message. */ /* Update field in header. */ /* Returns the last error code. */ /* Returns the full error message for last error. This message may contain paths etc. so it shouldn't be shown to users. */ /* Reset the error message. */ /* Apply changes in MAIL_INDEX_SYNC_TYPE_FLAGS typed sync records to given /* register index extension. name is a unique identifier for the extension. returns unique identifier for the name. */ /* Get current extension sizes. Returns 1 if ok, 0 if extension doesn't exist /* Resize existing extension data. If size is grown, the new data will be zero-filled. If size is shrinked, the data is simply dropped. */ /* Reset extension records and header. Any updates for this extension which were issued before the writer had seen this reset are discarded. reset_id is used to figure this out, so it must be different every time. */ /* Returns extension header. */ /* Returns the wanted extension record for given message. If it doesn't exist, *data_r is set to NULL. Return values are same as for mail_index_lookup(). */ /* Update extension header field. */ /* Update extension record. If old_data_r is non-NULL and the record extension was already updated in this transaction, it's set to contain the data it's