From 115f26cd36d90f2ed7d502469b8359a488be9c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Mon, 30 Nov 2020 22:01:52 +0100 Subject: [PATCH] docs fix --- docs/index.rst | 10 ++++------ docs/usage.rst | 4 ++++ tempsdb/chunks.pxd | 5 ++--- tempsdb/chunks.pyx | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index d14fa1b..9112bd4 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 ecd4b2e..f630e7c 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 35c5c2b..b9d02b9 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 725faa9..70e9202 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 -- GitLab