db.h
#ifndef ANI_DB_H
#define ANI_DB_H
/**
* The sanakirja database exists to allow the creation of data
* structures that most naturally lives in memory-mapped files.
*
* It is structured around pages, through two traits AllocPage and
* LoadPage. The assumption is that pages have 4K bytes.
*
* There is a Storable macro that types can implement to indicate they
* can be stored on disk. Implementations should allow for comparing
* types, getting references from a page to other pages (if they
* exist).
*/
#define PAGESZ 4096
struct globalheader {
u16 version; /* sanakirja version */
u8 root; /* which page is currently the root page? */
u8 nroots; /* how many root pages are there? */
u32 crc; /* CRC of this page */
u64 length; /* first free page at the end of the file */
u64 freedb; /* offset of the free list */
u64 rcdb; /* offset of the RC db */
};
void dbrun(char *);
#endif