[][src]Crate tslite

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

|--------------------------[TIMESTAMP]------------------------|---------[RECORD COUNT]-----------|
|      year      |  month |  day   |  hour  | minute | second |              64bit               |
|     16bit      |  8bit  |  8bit  |  8bit  |  8bit  |  8bit  |                                  |
|--------[TIME OFFSET]--------|-[VALUE]-|
|            32bit            |   8bit  |



The header of a DB file. origin_date is the date that will be use has the origin. The DB cannot contain any record anterior to this date.


a DB in file


Represent an entry in the database. time_offset represent the number of seconds passed since the origin date of the DB. It's a u32, which means you should be able to store record up to 136 years after the origin date of the DB.


A way to store date and time in 56bits / 7 octets. There is no awareness of timezone, everything is assumed to be Utc+0.



Potential Issue in the DB file


A wrapper for various type of error that can occur within TSLite.