Skip to content

Commit 51caf5b

Browse files
committed
initial implementation of persistence; tests TODO; refactoring TODO
1 parent 77637b9 commit 51caf5b

File tree

5 files changed

+688
-19
lines changed

5 files changed

+688
-19
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@ zarr/*.c
6464

6565
# setuptools-scm
6666
zarr/version.py
67+
68+
# test data
69+
*.zarr

zarr/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from __future__ import absolute_import, print_function, division
33

44

5-
from zarr.ext import Chunk, Array, SynchronizedChunk, blosc_version
5+
from zarr.ext import Chunk, Array, SynchronizedChunk, blosc_version, \
6+
PersistentChunk, PersistentArray
67
from zarr.core import empty, zeros, ones, full, array
78
from zarr import defaults
89
from zarr.version import version as __version__

zarr/ext.pxd

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ cdef class Chunk:
1616
cdef decompress(self, char *dest)
1717

1818

19+
# TODO remove code duplication with Chunk class
20+
cdef class PersistentChunk:
21+
cdef public object path
22+
cdef public object fill_value
23+
cdef public char *cname
24+
cdef public int clevel
25+
cdef public int shuffle
26+
cdef public tuple shape
27+
cdef public dtype dtype
28+
cdef read_header(self)
29+
cdef read(self)
30+
cdef write(self, bytes data)
31+
cdef compress(self, ndarray array)
32+
cdef decompress(self, char *dest)
33+
34+
1935
cdef class SynchronizedChunk(Chunk):
2036
cdef object lock
2137

@@ -30,3 +46,17 @@ cdef class Array:
3046
cdef public ndarray cdata
3147
cdef public object fill_value
3248
cdef public bint synchronized
49+
50+
51+
# TODO remove code duplication with Array class
52+
cdef class PersistentArray:
53+
cdef public bytes cname
54+
cdef public int clevel
55+
cdef public int shuffle
56+
cdef public tuple shape
57+
cdef public tuple chunks
58+
cdef public dtype dtype
59+
cdef public object mode
60+
cdef public ndarray cdata
61+
cdef public object fill_value
62+
cdef public bint synchronized

0 commit comments

Comments
 (0)