5 releases
0.1.5 | Nov 2, 2020 |
---|---|
0.1.3 | Jul 21, 2020 |
0.1.2 | Jul 21, 2020 |
0.1.1 | Jul 19, 2020 |
0.1.0 | Jul 19, 2020 |
#32 in #time-series-database
30KB
589 lines
TSLite : A small embeddable time-serie database
TSLite is a small and embeddable time-serie database that operate directly on a file. It has no concept of type, right now you can store anything that fit into 1 octet.
For more information look at the documentation :
git clone https://github.com/maeln/tslite.git
cd tslite
cargo doc --open
Look also at the tests to see exemple of how to use it.
lib.rs
:
A very simple embedded time-serie database.
Right now you can only store data that fit in one octet.
All the operation are made directly on the DB file, so this can get very I/O intensive if you do a lot of operation. If you are going to push data and read data a lot, you really shouldn't use it directly.
If you intend to do a lot of operation you should have an layer that will operate in-memory and periodically dump them to the filesystem.
DB encoding
Every number will be store in db with little-endian ordering. We will store records in db in a way that the latest (as in, its actual time) record will always be at the end of the file. But we should do something that will periodicly check the sanity of the DB and fix mistakes (i.e, sort the whole DB). This could be definitly be easier by holding the DB in memory and doing any I/O in memory before the DB is commited to the file.
File orga
+--------------------------------------------+
| HEADER | RECORD1 | RECORD2 | RECORD3 | ... |
+--------------------------------------------+
+-------------------------------------------[HEADER]---------------------------------------------+
|--------------------------[TIMESTAMP]------------------------|---------[RECORD COUNT]-----------|
| year | month | day | hour | minute | second | 64bit |
| 16bit | 8bit | 8bit | 8bit | 8bit | 8bit | |
+------------------------------------------------------------------------------------------------+
+-------------------[RECORD]------------+
|--------[TIME OFFSET]--------|-[VALUE]-|
| 32bit | 8bit |
+---------------------------------------+
Dependencies
~1.5MB
~20K SLoC