Skip to content
Snippets Groups Projects
Commit f94f475e authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

fixed madvise

parent ed39ea1e
No related branches found
No related tags found
No related merge requests found
......@@ -180,10 +180,10 @@ cdef class Chunk:
if self.pointer >= self.file_size-FOOTER_SIZE-self.block_size_plus:
self.extend()
cdef unsigned long long ptr_end = self.pointer + TIMESTAMP_SIZE
# Append entry
self.mmap[self.pointer:self.pointer+TIMESTAMP_SIZE] = STRUCT_Q.pack(timestamp)
self.mmap[self.pointer+TIMESTAMP_SIZE:self.pointer+TIMESTAMP_SIZE+self.block_size] = data
self.mmap[self.pointer:ptr_end] = STRUCT_Q.pack(timestamp)
self.mmap[ptr_end:ptr_end+self.block_size] = data
self.entries += 1
# Update entries count
self.mmap[self.file_size-FOOTER_SIZE:self.file_size] = STRUCT_L.pack(self.entries)
......
......@@ -67,8 +67,11 @@ cdef class Database:
:type page_size: int
: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
"""
if block_size > page_size + 8:
raise ValueError('Invalid block size, pick larger page')
if os.path.isdir(os.path.join(self.path, name)):
raise AlreadyExists('Series already exists')
cdef TimeSeries series = create_series(os.path.join(self.name, name),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment