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
1387547d
Commit
1387547d
authored
4 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
retry under bz2
parent
b548d41f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tempsdb/chunks/base.pyx
+3
-6
3 additions, 6 deletions
tempsdb/chunks/base.pyx
tempsdb/chunks/direct.pyx
+6
-7
6 additions, 7 deletions
tempsdb/chunks/direct.pyx
with
9 additions
and
13 deletions
tempsdb/chunks/base.pyx
+
3
−
6
View file @
1387547d
import
gzip
import
bz2
import
io
import
os
import
threading
...
...
@@ -28,15 +28,12 @@ cdef class AlternativeMMap:
def
madvise
(
self
,
a
,
b
,
c
):
...
def
resize
(
self
,
file_size
:
int
):
def
resize
(
self
,
int
file_size
):
self
.
size
=
file_size
def
__init__
(
self
,
io_file
:
io
.
BinaryIO
,
file_lock_object
):
self
.
io
=
io_file
if
isinstance
(
io_file
,
gzip
.
GzipFile
):
self
.
size
=
self
.
io
.
size
else
:
self
.
io
.
seek
(
self
.
file_size
,
0
)
self
.
io
.
seek
(
0
,
2
)
self
.
size
=
self
.
io
.
tell
()
self
.
file_lock_object
=
file_lock_object
...
...
This diff is collapsed.
Click to expand it.
tempsdb/chunks/direct.pyx
+
6
−
7
View file @
1387547d
import
bz2
import
gzip
import
os
import
typing
as
tp
import
struct
import
warnings
...
...
@@ -58,7 +60,7 @@ cdef class DirectChunk(Chunk):
cpdef
object
open_file
(
self
,
str
path
):
if
self
.
gzip
:
return
gzip
.
open
(
path
,
'
w
b+
'
,
compresslevel
=
self
.
gzip
)
return
bz2
.
BZ2File
(
path
,
'
r
b+
'
,
compresslevel
=
self
.
gzip
)
else
:
return
super
().
open_file
(
path
)
...
...
@@ -66,16 +68,13 @@ cdef class DirectChunk(Chunk):
return
0
cpdef
int
after_init
(
self
)
except
-
1
:
if
isinstance
(
self
.
file
,
gzip
.
GzipFile
):
self
.
file_size
=
self
.
file
.
size
else
:
self
.
io
.
seek
(
0
,
2
)
self
.
file_size
=
self
.
file
.
tell
()
self
.
file
.
seek
(
0
,
os
.
SEEK_END
)
self
.
file_size
=
self
.
file
.
tell
()
self
.
entries
=
(
self
.
file_size
-
HEADER_SIZE
)
//
self
.
block_size_plus
self
.
pointer
=
self
.
file_size
d
=
(
self
.
file_size
-
self
.
block_size
)
-
(
self
.
file_size
-
self
.
block_size_plus
)
cdef
bytes
b
=
self
.
mmap
[
self
.
file_size
-
self
.
block_size_plus
:
self
.
file_size
-
self
.
block_size
]
print
(
self
.
file
,
d
,
repr
(
b
))
self
.
max_ts
,
=
STRUCT_Q
.
unpack
(
b
)
return
0
...
...
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