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
8c632b52
Commit
8c632b52
authored
4 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
fix the docs
parent
115f26cd
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
docs/usage.rst
+11
-0
11 additions, 0 deletions
docs/usage.rst
tempsdb/database.pxd
+2
-2
2 additions, 2 deletions
tempsdb/database.pxd
tempsdb/database.pyx
+6
-2
6 additions, 2 deletions
tempsdb/database.pyx
tempsdb/series.pyx
+7
-5
7 additions, 5 deletions
tempsdb/series.pyx
with
26 additions
and
9 deletions
docs/usage.rst
+
11
−
0
View file @
8c632b52
How this does work?
===================
Data is stored in so called chunks. A chunk's last page can be actively appended to, or a chunk
is immutable.
When there is a request to fetch some data, a chunk is loaded into memory. It will not
be automatically unloaded, to do this, you must periodically call
:meth:`~tempsdb.series.TimeSeries.close_chunks`.
Usage
Usage
=====
=====
...
@@ -23,3 +33,4 @@ You retrieve their data via Iterators:
...
@@ -23,3 +33,4 @@ You retrieve their data via Iterators:
Appending the data is done via :meth:`~tempsdb.series.TimeSeries.append`. Since time series are
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
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.
quite fast, as in 99.9% cases it is just a memory operation.
This diff is collapsed.
Click to expand it.
tempsdb/database.pxd
+
2
−
2
View file @
8c632b52
...
@@ -3,12 +3,12 @@ from .series cimport TimeSeries
...
@@ -3,12 +3,12 @@ from .series cimport TimeSeries
cdef
class
Database
:
cdef
class
Database
:
cdef
:
cdef
:
str
path
readonly
str
path
bint
closed
bint
closed
object
lock
object
lock
object
mpm
object
mpm
cpdef
void
close
(
self
)
cpdef
int
close
(
self
)
except
-
1
cpdef
TimeSeries
get_series
(
self
,
str
name
)
cpdef
TimeSeries
get_series
(
self
,
str
name
)
cpdef
void
register_memory_pressure_manager
(
self
,
object
mpm
)
cpdef
void
register_memory_pressure_manager
(
self
,
object
mpm
)
cpdef
TimeSeries
create_series
(
self
,
str
name
,
int
block_size
,
cpdef
TimeSeries
create_series
(
self
,
str
name
,
int
block_size
,
...
...
This diff is collapsed.
Click to expand it.
tempsdb/database.pyx
+
6
−
2
View file @
8c632b52
...
@@ -10,6 +10,8 @@ cdef class Database:
...
@@ -10,6 +10,8 @@ cdef class Database:
A basic TempsDB object.
A basic TempsDB object.
:param path: path to the directory with the database
:param path: path to the directory with the database
:ivar path: path to the directory with the database (str)
"""
"""
def
__init__
(
self
,
path
:
str
):
def
__init__
(
self
,
path
:
str
):
self
.
path
=
path
self
.
path
=
path
...
@@ -65,6 +67,7 @@ cdef class Database:
...
@@ -65,6 +67,7 @@ cdef class Database:
:type page_size: int
:type page_size: int
:return: new series
:return: new series
:rtype: TimeSeries
:rtype: TimeSeries
:raises AlreadyExists: series with given name already exists
"""
"""
if
os
.
path
.
isdir
(
os
.
path
.
join
(
self
.
path
,
name
)):
if
os
.
path
.
isdir
(
os
.
path
.
join
(
self
.
path
,
name
)):
raise
AlreadyExists
(
'
Series already exists
'
)
raise
AlreadyExists
(
'
Series already exists
'
)
...
@@ -86,12 +89,13 @@ cdef class Database:
...
@@ -86,12 +89,13 @@ cdef class Database:
self
.
mpm
=
mpm
self
.
mpm
=
mpm
cdef
TimeSeries
series
cdef
TimeSeries
series
for
series
in
self
.
open_series
.
values
():
for
series
in
self
.
open_series
.
values
():
series
.
register_memory_pressure_manager
(
mpm
)
if
not
series
.
closed
:
series
.
register_memory_pressure_manager
(
mpm
)
def
__del__
(
self
):
def
__del__
(
self
):
self
.
close
()
self
.
close
()
cpdef
void
close
(
self
):
cpdef
int
close
(
self
)
except
-
1
:
"""
"""
Close this TempsDB database
Close this TempsDB database
"""
"""
...
...
This diff is collapsed.
Click to expand it.
tempsdb/series.pyx
+
7
−
5
View file @
8c632b52
...
@@ -282,7 +282,7 @@ cdef class TimeSeries:
...
@@ -282,7 +282,7 @@ cdef class TimeSeries:
cpdef
int
close_chunks
(
self
)
except
-
1
:
cpdef
int
close_chunks
(
self
)
except
-
1
:
"""
"""
Close all superficially opened chunks
Close all superficially opened chunks
.
"""
"""
if
self
.
last_chunk
is
None
:
if
self
.
last_chunk
is
None
:
return
0
return
0
...
@@ -295,12 +295,14 @@ cdef class TimeSeries:
...
@@ -295,12 +295,14 @@ cdef class TimeSeries:
with
self
.
open_lock
:
with
self
.
open_lock
:
for
chunk_name
in
chunks
:
for
chunk_name
in
chunks
:
if
chunk_name
!
=
last_chunk_name
:
if
chunk_name
=
=
last_chunk_name
:
continue
continue
elif
not
self
.
refs_chunks
[
chunk_name
]
:
elif
not
self
.
refs_chunks
.
get
(
chunk_name
,
0
)
:
self
.
open_chunks
[
chunk_name
].
close
()
self
.
open_chunks
[
chunk_name
].
close
()
del
self
.
open_chunks
[
chunk_name
]
try
:
del
self
.
refs_chunks
[
chunk_name
]
del
self
.
refs_chunks
[
chunk_name
]
except
KeyError
:
pass
return
0
return
0
cpdef
int
append
(
self
,
unsigned
long
long
timestamp
,
bytes
data
)
except
-
1
:
cpdef
int
append
(
self
,
unsigned
long
long
timestamp
,
bytes
data
)
except
-
1
:
...
...
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