Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tempsdb
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
tempsdb
Commits
e316e60a
Commit
e316e60a
authored
4 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
add Section.from_smok
parent
78628a41
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
setup.py
+1
-1
1 addition, 1 deletion
setup.py
tempsdb/series.pxd
+2
-0
2 additions, 0 deletions
tempsdb/series.pxd
tempsdb/series.pyx
+17
-0
17 additions, 0 deletions
tempsdb/series.pyx
with
21 additions
and
1 deletion
README.md
+
1
−
0
View file @
e316e60a
...
@@ -55,6 +55,7 @@ Then copy your resulting wheel and install it via pip on the target system.
...
@@ -55,6 +55,7 @@ Then copy your resulting wheel and install it via pip on the target system.
## v0.4.5
## v0.4.5
*
if page_size is default, it won't be written as part of the metadata
*
if page_size is default, it won't be written as part of the metadata
*
added support for per-series metadata
## v0.4.4
## v0.4.4
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
e316e60a
...
@@ -28,7 +28,7 @@ if 'CI' in os.environ:
...
@@ -28,7 +28,7 @@ if 'CI' in os.environ:
setup
(
name
=
'
tempsdb
'
,
setup
(
name
=
'
tempsdb
'
,
version
=
'
0.4.5a
2
'
,
version
=
'
0.4.5a
3
'
,
packages
=
[
'
tempsdb
'
],
packages
=
[
'
tempsdb
'
],
install_requires
=
[
'
satella>=2.14.24
'
,
'
ujson
'
],
install_requires
=
[
'
satella>=2.14.24
'
,
'
ujson
'
],
ext_modules
=
build
([
Multibuild
(
'
tempsdb
'
,
find_pyx
(
'
tempsdb
'
)),
],
ext_modules
=
build
([
Multibuild
(
'
tempsdb
'
,
find_pyx
(
'
tempsdb
'
)),
],
...
...
This diff is collapsed.
Click to expand it.
tempsdb/series.pxd
+
2
−
0
View file @
e316e60a
...
@@ -14,6 +14,7 @@ cdef class TimeSeries:
...
@@ -14,6 +14,7 @@ cdef class TimeSeries:
readonly
unsigned
int
block_size
readonly
unsigned
int
block_size
readonly
unsigned
long
long
last_entry_ts
readonly
unsigned
long
long
last_entry_ts
unsigned
int
page_size
unsigned
int
page_size
readonly
dict
metadata
readonly
bint
descriptor_based_access
readonly
bint
descriptor_based_access
list
chunks
list
chunks
dict
refs_chunks
# type: tp.Dict[int, int]
dict
refs_chunks
# type: tp.Dict[int, int]
...
@@ -40,6 +41,7 @@ cdef class TimeSeries:
...
@@ -40,6 +41,7 @@ cdef class TimeSeries:
cpdef
tuple
get_current_value
(
self
)
cpdef
tuple
get_current_value
(
self
)
cpdef
int
disable_mmap
(
self
)
except
-
1
cpdef
int
disable_mmap
(
self
)
except
-
1
cpdef
int
enable_mmap
(
self
)
except
-
1
cpdef
int
enable_mmap
(
self
)
except
-
1
cpdef
int
set_metadata
(
self
,
dict
new_meta
)
except
-
1
cdef
inline
int
get_references_for
(
self
,
unsigned
long
long
timestamp
):
cdef
inline
int
get_references_for
(
self
,
unsigned
long
long
timestamp
):
return
self
.
refs_chunks
.
get
(
timestamp
,
0
)
return
self
.
refs_chunks
.
get
(
timestamp
,
0
)
...
...
This diff is collapsed.
Click to expand it.
tempsdb/series.pyx
+
17
−
0
View file @
e316e60a
import
typing
as
tp
import
shutil
import
shutil
import
threading
import
threading
from
satella.json
import
write_json_to_file
,
read_json_from_file
from
satella.json
import
write_json_to_file
,
read_json_from_file
...
@@ -20,6 +21,7 @@ cdef class TimeSeries:
...
@@ -20,6 +21,7 @@ cdef class TimeSeries:
:ivar path: path to the directory containing the series (str)
:ivar path: path to the directory containing the series (str)
:ivar descriptor_based_access: are all chunks using descriptor-based access? (bool)
:ivar descriptor_based_access: are all chunks using descriptor-based access? (bool)
:ivar name: name of the series (str)
:ivar name: name of the series (str)
:ivar metadata: extra data (tp.Optional[dict])
"""
"""
cpdef
tuple
get_current_value
(
self
):
cpdef
tuple
get_current_value
(
self
):
"""
"""
...
@@ -51,6 +53,18 @@ cdef class TimeSeries:
...
@@ -51,6 +53,18 @@ cdef class TimeSeries:
chunk
.
switch_to_descriptor_based_access
()
chunk
.
switch_to_descriptor_based_access
()
return
0
return
0
cpdef
int
set_metadata
(
self
,
dict
new_meta
)
except
-
1
:
"""
Set a new value for the :attr:`~tempsdb.series.TimeSeries.metadata` property.
This writes the disk.
:param new_meta: new value of metadata property
"""
self
.
metadata
=
new_meta
self
.
sync_metadata
()
return
0
cpdef
int
enable_mmap
(
self
)
except
-
1
:
cpdef
int
enable_mmap
(
self
)
except
-
1
:
"""
"""
Switches to mmap-based file access method for the entire series,
Switches to mmap-based file access method for the entire series,
...
@@ -94,6 +108,7 @@ cdef class TimeSeries:
...
@@ -94,6 +108,7 @@ cdef class TimeSeries:
self
.
max_entries_per_chunk
=
metadata
[
'
max_entries_per_chunk
'
]
self
.
max_entries_per_chunk
=
metadata
[
'
max_entries_per_chunk
'
]
self
.
last_entry_synced
=
metadata
[
'
last_entry_synced
'
]
self
.
last_entry_synced
=
metadata
[
'
last_entry_synced
'
]
self
.
page_size
=
metadata
.
get
(
'
page_size
'
,
DEFAULT_PAGE_SIZE
)
self
.
page_size
=
metadata
.
get
(
'
page_size
'
,
DEFAULT_PAGE_SIZE
)
self
.
metadata
=
metadata
.
get
(
'
metadata
'
)
except
(
OSError
,
ValueError
)
as
e
:
except
(
OSError
,
ValueError
)
as
e
:
raise
Corruption
(
'
Corrupted series: %s
'
%
(
e
,
))
raise
Corruption
(
'
Corrupted series: %s
'
%
(
e
,
))
except
KeyError
:
except
KeyError
:
...
@@ -315,6 +330,8 @@ cdef class TimeSeries:
...
@@ -315,6 +330,8 @@ cdef class TimeSeries:
}
}
if
self
.
page_size
!=
DEFAULT_PAGE_SIZE
:
if
self
.
page_size
!=
DEFAULT_PAGE_SIZE
:
meta
[
'
page_size
'
]
=
self
.
page_size
meta
[
'
page_size
'
]
=
self
.
page_size
if
self
.
metadata
is
not
None
:
meta
[
'
metadata
'
]
=
self
.
metadata
return
meta
return
meta
cdef
void
register_memory_pressure_manager
(
self
,
object
mpm
):
cdef
void
register_memory_pressure_manager
(
self
,
object
mpm
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment