aboutsummaryrefslogtreecommitdiff
path: root/include/database.h
blob: 5f2d99dfe6a5c53fccdab913403609fbeecf3b85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef DATABASE_H
#define DATABASE_H

#include "db.h"


typedef struct database{
	char name[32];
	ltable *lfiles, *ltags;
	ctable *cfiles, *ctags;
	tree hfiles, htags;
	mtable *map;
} 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);

int addFileTag(database *db, char *file, char *tag);

int addFileTags(database *db, char *file, int ntags, ...);

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);

void printDatabase(database *db);

void debugAVLtree(node *n);

void debugDatabase(database *db);

#endif