aboutsummaryrefslogtreecommitdiff
path: root/DOC
diff options
context:
space:
mode:
authorSoikk2022-07-24 22:18:31 +0200
committerSoikk2022-07-24 22:18:31 +0200
commitff5da06da823ac3a0bc7e89b35ed573255139b2d (patch)
tree41551fe546a34ad8f771b5a75eb4d883db5fb4ac /DOC
parentcaacd02d3c6a6ab3ddea620214ee5d1836de2c31 (diff)
downloadsoikk-DB-ff5da06da823ac3a0bc7e89b35ed573255139b2d.tar.xz
soikk-DB-ff5da06da823ac3a0bc7e89b35ed573255139b2d.tar.zst
Added ref count for files & tags. Refactored database.c. Removed tags.h but kept documentation.
Diffstat (limited to 'DOC')
-rw-r--r--DOC10
1 files changed, 7 insertions, 3 deletions
diff --git a/DOC b/DOC
index d5ef900..6f1f195 100644
--- a/DOC
+++ b/DOC
@@ -73,18 +73,22 @@ DATABASE
A database consists of a 32 character (including trailing 0) name, and:
- 2 lookup tables (ltable) for storing the unique file and tag names.
- 2 hash tables (htable) for storing the hashes of the names in the ltables.
+ - 2 hash tables (htable) for storing the count of the files & tags in the mapping table (how many files one tags has and vice versa).
- 1 mapping tables (mtable) for storing the mappings of the tags to the files.
The lookup tables serve the purpose of looking up the names of the files and tags when needed.
- The hash tables serve the purpose of providing faster search times when searching for a file or tag.
- Each respective lookup and hash tables (lfiles and hfiles, ltags and htags) share indexes.
+ The first 2 hash tables serve the purpose of providing faster search times when searching for a file or tag.
+ The remaining 2 hash tables (fcount and tcount) serve the purpose of storing the count of how many of each file and tag is in the mapping table.
+ Each respective lookup and hash tables (lfiles, hfiles and fcount, ltags, htags and hcount) share indexes.
The mapping table serves the purpose of storing the relation between different files and tags as the pairing of their indexes.
- A databbase is written to disk in the following format:
+ A database is written to disk in the following format:
- 2 bytes as a header that store the 'DB' ASCII characters.
- 32 bytes that store the name of the database.
- The lfiles ltable.
- The ltags ltable.
- The hfiles htable.
- The htags htable.
+ - The fcount htable;
+ - The tcount htable;
- The map mtable.
- 3 bytes as "end" that store the 'END'"' ASCII characters.
When loading a database, if the header doesn't match, it will print "Header is '(header)' not 'DB'" to standard error.