Top |
Functions
Types and Values
typedef | camel_block_t |
typedef | camel_key_t |
enum | CamelBlockFileFlags |
#define | CAMEL_BLOCK_SIZE |
#define | CAMEL_BLOCK_SIZE_BITS |
enum | CamelBlockFlags |
struct | CamelBlockRoot |
struct | CamelBlock |
Functions
camel_block_file_new ()
CamelBlockFile * camel_block_file_new (const gchar *path
,gint flags
,const gchar version[8]
,gsize block_size
);
Allocate a new block file, stored at path
. version
contains an 8 character
version string which must match the head of the file, or the file will be
intitialised.
block_size
is currently ignored and is set to CAMEL_BLOCK_SIZE.
camel_block_file_new_block ()
CamelBlock *
camel_block_file_new_block (CamelBlockFile *bs
);
Allocate a new block, return a pointer to it. Old blocks may be flushed to disk during this call.
camel_block_file_free_block ()
gint camel_block_file_free_block (CamelBlockFile *bs
,camel_block_t id
);
camel_block_file_get_block ()
CamelBlock * camel_block_file_get_block (CamelBlockFile *bs
,camel_block_t id
);
Retreive a block id
.
camel_block_file_detach_block ()
void camel_block_file_detach_block (CamelBlockFile *bs
,CamelBlock *bl
);
Detatch a block from the block file's cache. The block should be unref'd or attached when finished with. The block file will perform no writes of this block or flushing of it if the cache fills.
camel_block_file_attach_block ()
void camel_block_file_attach_block (CamelBlockFile *bs
,CamelBlock *bl
);
Reattach a block that has been detached.
camel_block_file_touch_block ()
void camel_block_file_touch_block (CamelBlockFile *bs
,CamelBlock *bl
);
Mark a block as dirty. The block will be written to disk if it ever expires from the cache.
camel_block_file_unref_block ()
void camel_block_file_unref_block (CamelBlockFile *bs
,CamelBlock *bl
);
Mark a block as unused. If a block is used it will not be written to disk, or flushed from memory.
If a block is detatched and this is the last reference, the block will be freed.
camel_block_file_sync_block ()
gint camel_block_file_sync_block (CamelBlockFile *bs
,CamelBlock *bl
);
Flush a block to disk immediately. The block will only be flushed to disk if it is marked as dirty (touched).
camel_block_file_sync ()
gint
camel_block_file_sync (CamelBlockFile *bs
);
Sync all dirty blocks to disk, including the root block.
camel_key_file_new ()
CamelKeyFile * camel_key_file_new (const gchar *path
,gint flags
,const gchar version[8]
);
Create a new key file. A linked list of record blocks.
camel_key_file_write ()
gint camel_key_file_write (CamelKeyFile *kf
,camel_block_t *parent
,gsize len
,camel_key_t *records
);
Write a new list of records to the key file.
camel_key_file_read ()
gint camel_key_file_read (CamelKeyFile *kf
,camel_block_t *start
,gsize *len
,camel_key_t **records
);
Read the next block of data from the key file. Returns the number of records.
Types and Values
camel_block_t
typedef guint32 camel_block_t; /* block offset, absolute, bottom BLOCK_SIZE_BITS always 0 */
struct CamelBlockRoot
struct CamelBlockRoot { gchar version[8]; /* version number */ guint32 flags; /* flags for file */ guint32 block_size; /* block size of this file */ camel_block_t free; /* free block list */ camel_block_t last; /* pointer to end of blocks */ /* subclasses tack on, but no more than CAMEL_BLOCK_SIZE! */ };