Uh oh!
There was an error while loading. Please reload this page.
Refactor out _tofile/_fromfile from DirectoryStore - #503
Conversation
To make it easier to sub out different ways of reading and writing data, create to methods to handle reading and writing directly. This way users don't need to reimplement all of the same logic that `__getitem__` and `__setitem__` are doing and can focus on simply reading and writing. Can be useful for trying memmaping for example.
Uh oh!
There was an error while loading. Please reload this page.
Co-Authored-By: James Bourbeau <jrbourbeau@users.noreply.github.com>
mzjp2
left a comment
There was a problem hiding this comment.
LGTM! 🎉 I'm missing context on this, but is it worth making mode a keyword argument which defaults to rb/wb or is there no situation where someone might need a different mode?
jakirkham
commented
Nov 9, 2019
The idea would be subclasses could override |
jrbourbeau
left a comment
There was a problem hiding this comment.
Thanks @jakirkham, this looks great and should definitely help with extending the DirectoryStore! I've left one small documentation comment below. Also, could you please add a changelog entry? Otherwise LGTM
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jakirkham
commented
Nov 11, 2019
Thanks for the feedback. Have added two docstrings based on what you mentioned. Please let me know if there is anything else. 🙂 |
jakirkham
commented
Nov 12, 2019
Planning on merging EOD tomorrow if no comments. |
jakirkham
commented
Nov 12, 2019
Thanks James! 😄 |
To make it easier for users to implement their own methods for reading and writing from disk ( like memory-mapping #377 ), refactor out
_tofileand_fromfilemethods that are called to handle the reading and writing of the value. Should avoid duplicating a lot of other logic when trying to extendDirectoryStores for these cases.TODO:
tox -e docs)