diff --git a/setup.py b/setup.py index ea86be0d18c7b16ef717c6ef6d498a22a50dadb6..dfae4b4737d3a160069e0b569b03300cc5f89ef2 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,8 @@ def find_pyx(*path) -> tp.List[str]: # directives = {'language_level': '3'} if 'CI' in os.environ: - directives.update(profile=True, linetrace=True) + directives.update(profile=True, linetrace=True, embedsignature=True) + setup(name='tempsdb', version='0.4.3_a3', diff --git a/tempsdb/chunks.pyx b/tempsdb/chunks.pyx index e2a6fc21ce55095712b3022acf12617c3627577d..fba7706605e4181834cf7bc2e525e8d51310a9c3 100644 --- a/tempsdb/chunks.pyx +++ b/tempsdb/chunks.pyx @@ -66,9 +66,7 @@ cdef class Chunk: will use descriptor-based access. :param parent: parent time series - :type parent: tp.Optional[TimeSeries] :param path: path to the chunk file - :type path: str :param use_descriptor_access: whether to use descriptor based access instead of mmap :ivar path: path to the chunk (str) @@ -152,10 +150,8 @@ cdef class Chunk: :param timestamp: timestamp to look for, must be smaller or equal to largest element in the chunk - :type timestamp: int :return: index such that ts[i] <= timestamp and (timestamp-ts[i]) -> min, or length of the array if timestamp is larger than largest element in this chunk - :rtype: int """ cdef: unsigned int hi = self.length() @@ -178,9 +174,7 @@ cdef class Chunk: :meth:`~tempsdb.chunks.Chunk.find_right` and finish at this inclusive. :param timestamp: timestamp to look for - :type timestamp: int :return: index such that ts[i] > timestamp and (ts[i]-timestamp) -> min - :rtype: int """ cdef: unsigned int hi = self.length() @@ -230,9 +224,7 @@ cdef class Chunk: Get timestamp at given entry :param index: index of the entry - :type index: int :return: timestamp at this entry - :rtype: int """ cdef unsigned long offset = HEADER_SIZE+index*self.block_size_plus return STRUCT_Q.unpack(self.mmap[offset:offset+TIMESTAMP_SIZE])[0] @@ -258,9 +250,7 @@ cdef class Chunk: :class:`~tempsdb.series.TimeSeries`. :param timestamp: timestamp of the entry - :type timestamp: int :param data: data to write - :type data: bytes :raises InvalidState: chunk is closed """ if self.closed: @@ -285,9 +275,7 @@ cdef class Chunk: Return a partial iterator starting at starting_entry and ending at stopping_entry (exclusive). :param starting_entry: index of starting entry - :type starting_entry: int :param stopping_entry: index of stopping entry - :type stopping_entry: :return: an iterator :rtype: tp.Iterator[tp.Tuple[int, bytes]] """ @@ -344,18 +332,12 @@ cpdef Chunk create_chunk(TimeSeries parent, str path, unsigned long long timesta Creates a new chunk on disk :param parent: parent time series - :type parent: TimeSeries :param path: path to the new chunk file - :type path: str :param timestamp: timestamp for first entry to contain - :type timestamp: int :param data: data of the first entry - :type data: bytes :param page_size: size of a single page for storage - :type page_size: int :param descriptor_based_access: whether to use descriptor based access instead of mmap. Default is False - :type descriptor_based_access: bool :raises ValueError: entries in data were not of equal size, or data was empty or data was not sorted by timestamp or same timestamp appeared twice :raises AlreadyExists: chunk already exists diff --git a/tempsdb/database.pyx b/tempsdb/database.pyx index 9ba9dbccf5f53a6f425b45b471e36c4a6564b010..9412572375b2d340e95075e77f0588c81d1d907c 100644 --- a/tempsdb/database.pyx +++ b/tempsdb/database.pyx @@ -50,13 +50,10 @@ cdef class Database: Load and return an existing series :param name: name of the series - :type name: str :param use_descriptor_based_access: whether to use descriptor based access instead of mmap, default is False - :type use_descriptor_based_access: bool :return: a loaded time series - :rtype: TimeSeries :raises DoesNotExist: series does not exist """ cdef: @@ -97,9 +94,7 @@ cdef class Database: Get first timestamp stored in a particular series without opening it :param name: series name - :type name: str :return: first timestamp stored in this series - :rtype: int :raises DoesNotExist: series does not exist :raises ValueError: timestamp does not have any data """ @@ -147,18 +142,12 @@ cdef class Database: Create a new series :param name: name of the series - :type name: str :param block_size: size of the data field - :type block_size: int :param entries_per_chunk: entries per chunk file - :type entries_per_chunk: int :param page_size: size of a single page. Default is 4096 - :type page_size: int :param use_descriptor_based_access: whether to use descriptor based access instead of mmap. Default is False - :type use_descriptor_based_access: bool :return: new series - :rtype: TimeSeries :raises ValueError: block size was larger than page_size plus a timestamp :raises AlreadyExists: series with given name already exists """ @@ -211,9 +200,7 @@ cpdef Database create_database(str path): Creates a new, empty database :param path: path where the DB directory will be put - :type path: str :return: a Database object - :rtype: Database :raises AlreadyExists: the directory exists """ if os.path.exists(path): diff --git a/tempsdb/series.pyx b/tempsdb/series.pyx index ec9bc2faec577eb2be51756194384099bbad3cae..0fcefed4cbeb9439b431057af88cff4e4354ebc3 100644 --- a/tempsdb/series.pyx +++ b/tempsdb/series.pyx @@ -125,9 +125,7 @@ cdef class TimeSeries: Acquires a reference to the chunk. :param name: name of the chunk - :type name: int :return: chunk - :rtype: Chunk :raises DoesNotExist: chunk not found :raises InvalidState: resource closed """ @@ -155,7 +153,6 @@ cdef class TimeSeries: on. This will not delete currently opened chunks! :param timestamp: timestamp to delete entries earlier than - :type timestamp: int """ if len(self.chunks) == 1: return 0 @@ -207,9 +204,7 @@ cdef class TimeSeries: :param timestamp: timestamp to check, larger than first timestamp, smaller or equal to current timestamp - :type timestamp: int :return: name of the starting chunk - :rtype: int """ cdef: unsigned int lo = 0 @@ -235,11 +230,8 @@ cdef class TimeSeries: Return an iterator through collected data with given timestamps. :param start: timestamp to start at - :type start: int :param stop: timestamp to stop at - :type stop: int :return: an iterator with the data - :rtype: Iterator :raises ValueError: start larger than stop """ if self.last_chunk is None: @@ -270,7 +262,6 @@ cdef class TimeSeries: Mark the series as synced up to particular timestamp :param timestamp: timestamp of the last synced entry - :type timestamp: int """ self.last_entry_synced = timestamp self.sync_metadata() @@ -347,9 +338,7 @@ cdef class TimeSeries: Append an entry. :param timestamp: timestamp, must be larger than current last_entry_ts - :type timestamp: int :param data: data to write - :type data: bytes :raises ValueError: Timestamp not larger than previous timestamp or invalid block size :raises InvalidState: the resource is closed """ @@ -393,8 +382,7 @@ cdef class TimeSeries: """ Calculate how much RAM does the mmaped space take - :return: how much RAM do the opened chunks consume? - :rtype: int + :return: how much RAM, in bytes, do the opened chunks consume? """ cdef: unsigned long ram = 0