WYRDTEK Home Features Reference Downloads About



int es_mb_savebuffer( struct es_mb *db, const char *filen, unsigned bufsize, unsigned wmax );


struct es_mb *db Database to be saved.
const char *filen File path name prefix.
unsigned bufsize Buffer size used in serializing database.
unsigned wmax Maximum file size.

Return Codes

ES_ERROR_NONE Success. No errors.
ES_ERROR_FAILTOSAVE Failed to save. Check errno for any system errors.


es_mb_savefile is a wrapper function over es_mb_save() for serializing a database to a file.

bufsize is the size of the internal buffer used by es_mb_savefile in serializing the database.

es_mb_savefile creates multiple files on disk depending on the wmax parameter. Initially a file is created with the name filen as a prefix and "_0.mb" as a postfix. Once roughly wmax bytes have been written to disk a new file with the postfix "_1.mb" is created and es_mb_savefile continues to serialize to this new file. es_mb_savefile continues to create new files every wmax bytes until serialization is complete.

Set wmax to zero to force es_mb_savefile() to serialize the entire database to one file only.

[Back To Reference] [Back To Reference/es_mb]