diff --git a/README.md b/README.md index bfe477b8b539edb1d2cf3abfa387381e9f0b463b..4bbc04bf0ee70447e20dd725752634a001dd748c 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,10 @@ python setup.py bdist_wheel Then copy your resulting wheel and install it via pip on the target system. # Changelog + ## v0.5.2 -* _TBA_ +* added multiple properties and attributes to `VarlenSeries` ## v0.5.1 diff --git a/setup.py b/setup.py index 9265f8c4d6d66e42e0e942dba6641d51cebba767..b1aaad907d37297b7d59197ced49eb943f1bd891 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ ext_modules = build([Multibuild('tempsdb', find_pyx('tempsdb'), **ext_kwargs), ] **cythonize_kwargs) setup(name='tempsdb', - version='0.5.2a1', + version='0.5.2a2', packages=find_packages(include=['tempsdb', 'tempsdb.*']), install_requires=['satella>=2.14.24', 'ujson'], ext_modules=ext_modules, diff --git a/tempsdb/varlen.pxd b/tempsdb/varlen.pxd index f5bef0b6e5b03d7d7b01f6db721a0dd84de56716..b3ee95c882947cb4c81f0ef0fb759a07dbee7bee 100644 --- a/tempsdb/varlen.pxd +++ b/tempsdb/varlen.pxd @@ -7,12 +7,12 @@ cdef class VarlenSeries: int size_field int references object size_struct - str path - str name + readonly str path + readonly str name TimeSeries root_series readonly list series - list length_profile - int max_entries_per_chunk + readonly list length_profile + readonly int max_entries_per_chunk int current_maximum_length object mpm int gzip_level diff --git a/tempsdb/varlen.pyx b/tempsdb/varlen.pyx index 25997cbec1a0af84bed2d75eada7a28ac40794c0..d60c05d4c8b8a5d62a04b4b08ace8c45c817bd82 100644 --- a/tempsdb/varlen.pyx +++ b/tempsdb/varlen.pyx @@ -296,6 +296,11 @@ cdef class VarlenIterator: :class:`~tempsdb.varlen.VarlenEntry`. Note that setting this to True will result in a performance drop, since it will copy, but it should be faster if your typical entry is less than 20 bytes. + + :ivar name: series' name (str) + :ivar path: path to series' directory (str) + :ivar max_entries_per_chunk: maximum entries per chunk (int) + :ivar length_profile: length profile (tp.List[int]) """ def __init__(self, parent: VarlenSeries, start: int, stop: int, direct_bytes: bool = False): @@ -438,6 +443,16 @@ cdef class VarlenSeries: series.close_chunks() return 0 + @property + cpdef unsigned long long last_entry_ts(self): + """ + :return: last entry's timestamp, or barring that a 0 + """ + try: + return self.get_current_value()[0] + except ValueError: + return 0 + cpdef VarlenIterator iterate_range(self, unsigned long long start, unsigned long long stop, bint direct_bytes=False): """