aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/database.h12
-rw-r--r--include/storage.h14
2 files changed, 18 insertions, 8 deletions
diff --git a/include/database.h b/include/database.h
index 5f2d99d..1ae65b6 100644
--- a/include/database.h
+++ b/include/database.h
@@ -15,10 +15,6 @@ typedef struct database{
database *newDatabase(char *name);
-database *loadDatabase(const char* path);
-
-int storeDatabase(database *db, const char *path);
-
uint64_t addFile(database *db, char *file);
uint64_t addTag(database *db, char *tag);
@@ -27,10 +23,18 @@ int addFileTag(database *db, char *file, char *tag);
int addFileTags(database *db, char *file, int ntags, ...);
+int removeFile(database *db, char *file);
+
+int removeTag(database *db, char *tag);
+
int searchFile(database *db, char *file, uint64_t n, uint64_t **r, uint64_t *rl);
int searchTag(database *db, char *tag, uint64_t n, uint64_t **r, uint64_t *rl);
+int storeDatabase(database *db, const char *path);
+
+database *loadDatabase(const char* path);
+
void printDatabase(database *db);
void debugAVLtree(node *n);
diff --git a/include/storage.h b/include/storage.h
index 8bfc751..dccfa5f 100644
--- a/include/storage.h
+++ b/include/storage.h
@@ -60,7 +60,7 @@ typedef struct lookupTable{
char **table; // They cant be longer than MAXPATH
} ltable;
-// Stores a number (used as the count for files and tags in the mapping table)
+// Stores a number in the index that references the ltable (used as the count for files and tags in the mapping table)
typedef struct countTable{
uint64_t size;
uint64_t *table;
@@ -94,6 +94,8 @@ ltable *newLtable(uint64_t size);
int ltableAdd(ltable *lt, char *str);
+int ltableRemove(ltable *lt, char *str);
+
uint64_t ltableSearch(ltable *lt, char *str);
int storeLtable(const ltable *lt, FILE *fp);
@@ -106,7 +108,7 @@ ctable *newCtable(uint64_t size);
int ctableAdd(ctable *ct, uint64_t n);
-int ctableDelete(ctable *ct, uint64_t n);
+int ctableRemove(ctable *ct, uint64_t n);
uint64_t ctableSearch(ctable *ct, uint64_t n);
@@ -120,6 +122,12 @@ mtable *newMtable(uint64_t size);
int mtableAdd(mtable *mt, relation r);
+int mtableRemove(mtable *mt, relation r);
+
+int mtableRemoveFile(mtable *mt, uint64_t file);
+
+int mtableRemoveTag(mtable *mt, uint64_t tag);
+
uint64_t mtableSearch(mtable *mt, relation r);
uint64_t mtableSearchFile(mtable *mt, uint64_t file);
@@ -132,8 +140,6 @@ mtable *loadMtable(FILE *fp);
// AVL TREE
-uint64_t height(node *n);
-
node *newNode(uint64_t h, uint64_t i);
node *insertNode(node *r, uint64_t h, uint64_t i);