wip
This commit is contained in:
parent
98a1f5f671
commit
19db0f342c
4 changed files with 156 additions and 1 deletions
47
lsm/include/lsm.h
Normal file
47
lsm/include/lsm.h
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue