DOC: Add memory-mapping example to storage guide#2737
DOC: Add memory-mapping example to storage guide#2737bendichter wants to merge 3 commits intozarr-developers:mainfrom
Conversation
Fixes zarr-developers#1245 Add documentation and tests for memory-mapped store, focusing on efficient access to small slices from large uncompressed chunks.
| def _fromfile(self, fn: str) -> memoryview: | ||
| with open(fn, "rb") as fh: | ||
| return memoryview(mmap.mmap(fh.fileno(), 0, prot=mmap.PROT_READ)) |
There was a problem hiding this comment.
I don't think _fromfile will ever be invoked, since it's not part of the LocalStore API
|
thanks for this addition, however I do think it's worth thinking about whether a special store subclass is the right approach here. Presumably any store the supports range reads also supports reading slices from uncompressed chunks, so just subclassing |
|
That's true. Would it be better to implement this as a codec? |
|
I think this logic should probably live in the
|
True, but let's focus on reading for now.
This will be very dependent on the use case. We can add a flag for this and have it set to false by default for backwards compatibility. Then the user can switch the flag as needed. |
|
So it sounds like you want a more integrated solution than an ad hoc override? How would you feel about adding this here until we have a more robust and integrated solution? |
|
I don't think the proposed changes here actually implement anything, since the |
Fixes #1245
Add documentation and tests for memory-mapped store, focusing on efficient access to small slices from large uncompressed chunks.
TODO:
docs/user-guide/*.rstdocs/release-notes.rst