#ifndef LSM #define LSM #include #define LSM_RES(x) \ { \ lsm_error res = x; \ if (res != lsm_error_ok) \ return res; \ } #define LSM_RES2(x, e) \ { \ lsm_error res = x; \ if (res != lsm_error_ok) { \ e; \ return res; \ } \ } typedef enum lsm_error { lsm_error_ok = 0, lsm_error_failed_alloc = 1, lsm_error_not_found = 2, lsm_error_already_present = 3, lsm_error_null_value = 4, lsm_error_failed_io = 5, lsm_error_lock_busy = 6, } lsm_error; /*typedef struct lsm_string { */ /* uint64_t len; */ /* union { */ /* void *ptr; */ /* char val[8]; */ /* } str; */ /*} lsm_string; */ /*/1** */ /* * The type of an attribute. Each type is represented as a single bit of a */ /* * 32-bit integer, so they can be easily combined into a bitmap. */ /* *1/ */ /*typedef enum lsm_attr_type { lsm_attr_type_entry_type = 1 << 0 } * lsm_attr_type; */ /*/1** */ /* * A single attribute associated with an entry */ /* *1/ */ /*typedef struct lsm_attr { */ /* lsm_attr_type type; */ /* lsm_string str; */ /*} lsm_attr; */ /*/1** */ /* * Represents a collection of attributes for an entry. A collection can only */ /* * contain one of each attribute. */ /* *1/ */ /*typedef struct lsm_attr_list { */ /* uint64_t count; */ /* lsm_attr *items; */ /* uint32_t bitmap; */ /*} lsm_attr_list; */ /*/1** */ /* * An entry inside an LSM store */ /* *1/ */ /*typedef struct lsm_entry { */ /* lsm_string key; */ /* lsm_attr_list attrs; */ /* lsm_string data; */ /*} lsm_entry; */ /*/1** */ /* * A store of entries, which manages its data both in-memory and on disk. */ /* *1/ */ /*typedef struct lsm_store lsm_store; */ #endif