Bug fixes in tsdb_api.c.
1. Increased size of a tag array to accomodate a binary array of maximum possible size, i.e. number of bits equal to maximal size of an epoch associated record in all chunks.
2. Possible memory leak bug fixed.
3. Corrected logic of merging several tag arrays when their lengths are not aligned with words (32 bits). Now this is taken into account and not aligned bits are merged using mask for their selection in a next adjacent word.
Lots of debugs (particularily with memory leacks) and logic fixed. New file test-queryTime was added to profile write/read time depending on DB size both in number of epochs and metrics. Bugged behaviour detected when writing arbitratily key-value pairs - segmentation fault. It's a bug of original API, it is to be addressed.
Initial commit
Summing up the changes so far:
1. Added function db_key_exists() to the API to check for a key existence without forcing to load the pair key-value, as the original function tsdb_goto_epoch() does
2. Added two mode fields in the TSDB: "num_epochs" to keep account of number of epochs in the DB, "recent_epoch" to store the mose recent time stamp of written values. This both fields allows evaluation of time frame of the TSDB, so that we can calculate the very first epoch, the last one and all intermediate.
3. Changed logic of epoch normalization. Provided time stamps must be in UTC Unix format. Hence no transformation from local time to UTC is required. Moreover, now we do not trigger DB sync operation on every write within current epoch if the provided timestamp is renormalized to the current value.
4. Completely rewritten logic of creating a new epoch entry with chunks.
5. Lots of memory leaks and were found and fixed.
6. Some simplification to code were made, e.g., malloc was replaced with realloc in loops with iterative memory allocation
7. Test routine test_queryTime.c was written to profile DB writing and reading performance.
Merge branch 'master' of https://github.com/ol-kl/tsdb-api
merging
edited readme
Extensions
1. Added header of new API
2. Now the DB stores a list of all epochs
3. Logic of moving across epochs was changed: moving to oled non-exisintg epoch, i.e. which would have an epoch value lower the the most recent written one, is prohibited and the function call returns -1. This helps keeping the array of epochs in sorted way, in ascending order, without using sorting routines.
4. Test was changed accordingly to reflect the features and test them. The DB writing part is complete, the querying part is yet to be corrected though.