mdbox-map.h revision 4fded1eec06aba9ce37887ac30619768760cd0d0
#ifndef MDBOX_MAP_H
#define MDBOX_MAP_H
#include "seq-range-array.h"
struct dbox_file_append_context;
struct mdbox_map_append_context;
struct mdbox_storage;
enum mdbox_map_append_flags {
DBOX_MAP_APPEND_FLAG_ALT = 0x01
};
struct mdbox_map_mail_index_header {
/* increased every time storage is rebuilt */
};
struct mdbox_map_mail_index_record {
};
struct mdbox_map_file_msg {
};
struct mdbox_map *
const char *path);
/* Open the map. Returns 1 if ok, 0 if map doesn't exist, -1 if error. */
/* Open or create the map. This is done automatically for most operations.
Returns 0 if ok, -1 if error. */
/* Refresh the map. Returns 0 if ok, -1 if error. */
/* Return the current rebuild counter */
/* Look up file_id and offset for given map UID. Returns 1 if ok, 0 if UID
is already expunged, -1 if error. */
/* Like mdbox_map_lookup(), but look up everything. */
struct mdbox_map_mail_index_record *rec_r,
/* Get all messages from file */
/* Begin atomic context. There can be multiple transactions/appends within the
same atomic context. */
/* Lock the map immediately. */
/* Returns TRUE if map is locked */
/* When finish() is called, rollback the changes. If data was already written
to map's transaction log, this desyncs the map and causes a rebuild */
/* Mark this atomic as having succeeded. This is internally done if
transaction or append is committed within this atomic, but not when the
atomic is used standalone. */
struct mdbox_map_transaction_context *
bool external);
/* Write transaction to map and leave it locked. Call _free() to update tail
offset and unlock. */
/* Return all files containing messages with zero refcount. */
struct mdbox_map_append_context *
/* Request file for saving a new message with given size (if available). If an
existing file can be used, the record is locked and updated in index.
Returns 0 if ok, -1 if error. */
enum mdbox_map_append_flags flags,
struct dbox_file_append_context **file_append_ctx_r,
/* Finished saving the last mail. Saves the message size. */
/* Abort saving the last mail. */
/* Assign map UIDs to all appended msgs to multi-files. */
/* The appends are existing messages that were simply moved to a new file.
map_uids contains the moved messages' map UIDs. */
/* Returns 0 if ok, -1 if error. */
/* Returns map's uidvalidity */
#endif