diff --git a/docs/index.rst b/docs/index.rst index d14fa1b792248dd81c81d12c55b72fd7d138d5e0..9112bd49d0eb89fd49ed57924298569bbfc0710c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,8 +1,3 @@ -.. tempsdb documentation master file, created by - sphinx-quickstart on Sat Nov 28 15:49:03 2020. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - Welcome to tempsdb's documentation! =================================== @@ -15,8 +10,11 @@ Welcome to tempsdb's documentation! chunks memory-pressure-manager +This is an append-only embedded time series library written in Cython. + It tries to use mmap for reads and writes, and in general is as zero-copy as possible (ie. the -only time data is unserialized is when a particular entry is read). +only time data is unserialized is when a particular entry is read). It also uses +iterators. Stored time series with a 8-bit timestamp and a fixed length of data. So no variable encoding for you! diff --git a/docs/usage.rst b/docs/usage.rst index ecd4b2edd85e29eaa7f78da70c8943091527404b..f630e7cc3178108747ddb6fc96025b807d4ef87b 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -19,3 +19,7 @@ You retrieve their data via Iterators: .. autoclass:: tempsdb.iterators.Iterator :members: + +Appending the data is done via :meth:`~tempsdb.series.TimeSeries.append`. Since time series are +allocated in entire pages, so your files will be padded to a page in size. This makes writes +quite fast, as in 99.9% cases it is just a memory operation. diff --git a/tempsdb/chunks.pxd b/tempsdb/chunks.pxd index 35c5c2bb9c2982182876b12a39e163d551a154f2..b9d02b9c0e61c08e450dde7f5599283f69119be6 100644 --- a/tempsdb/chunks.pxd +++ b/tempsdb/chunks.pxd @@ -12,9 +12,8 @@ cdef class Chunk: readonly unsigned long entries unsigned long file_size unsigned long pointer # position to write next entry at - unsigned long page_size - object file - object mmap + readonly unsigned long page_size + object file, mmap bint closed cpdef object iterate_indices(self, unsigned long starting_entry, unsigned long stopping_entry) diff --git a/tempsdb/chunks.pyx b/tempsdb/chunks.pyx index 725faa9e345871044de981731682fa204fbe096a..70e9202f9cc148e0a813470a5de387ca9a5ac2c3 100644 --- a/tempsdb/chunks.pyx +++ b/tempsdb/chunks.pyx @@ -1,5 +1,4 @@ import os -import threading import typing as tp import struct import mmap @@ -32,6 +31,7 @@ cdef class Chunk: :ivar block_size: size of the data entries (int) :ivar entries: amount of entries in this chunk (int) :ivar writable: is this chunk writable (bool) + :ivar page_size: size of the page (int) """ def __init__(self, parent: tp.Optional[TimeSeries], path: str, page_size: int): cdef bytes b