From 28578b192d0828a9820983b5624b9bcc3577cd18 Mon Sep 17 00:00:00 2001 From: Soikk Date: Sat, 23 Jul 2022 01:46:24 +0200 Subject: Improved the database storage system. Added persistency. --- include/database.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 include/database.h (limited to 'include/database.h') diff --git a/include/database.h b/include/database.h new file mode 100644 index 0000000..2b1c91a --- /dev/null +++ b/include/database.h @@ -0,0 +1,31 @@ +#ifndef DATABASE_H +#define DATABASE_H + +#include "db.h" + + +typedef struct database{ + char name[32]; + ltable *lfiles, *ltags; + htable *hfiles, *htags; + mtable *map; +} database; + + +database *newDatabase(char *name); + +database *loadDatabase(const char* path); + +int storeDatabase(database *db, const char *path); + +int addFileTag(database *db, char *file, char *tag); + +int addFileTags(database *db, char *file, int ntags, ...); + +int searchTag(database *db, char *tag, uint64_t *rl); + +void printDatabase(database *db); + +void debugDatabase(database *db); + +#endif -- cgit v1.2.3