lander/lsm/include/lsm.h

48 lines
876 B
C

#include <stdint.h>
/**
* Represents a string (or really any kind of data) with a known length. Data
* with length 8 or less is stored inside the pointer instead of needlessly
* allocating additional memory.
*/
typedef struct lsm_string {
uint64_t len;
union {
void *ptr;
char val[8];
} str;
} lsm_string;
typedef enum lsm_attr_type {
lsm_attr_type_entry_type = 0
} lsm_attr_type;
typedef struct lsm_attr {
lsm_attr_type type;
lsm_string str;
} lsm_attr;
/**
* Represents a collection of metadata objects
*/
typedef struct lsm_attr_list {
uint64_t count;
lsm_attr *items;
} lsm_attr_list;
/**
* An entry inside
*/
typedef struct lsm_entry {
lsm_string key;
lsm_attr_list attrs;
lsm_string data;
} lsm_entry;
/**
* A store of entries, which manages its data both in-memory and on disk.
*/
typedef struct lsm_store {
} lsm_store;