Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read-only mode #18

Open
maxhutch opened this issue Sep 29, 2015 · 3 comments
Open

read-only mode #18

maxhutch opened this issue Sep 29, 2015 · 3 comments

Comments

@maxhutch
Copy link

I use chests to distribute data. In most cases, the data consumer either doesn't want to change the contents of the chest or doesn't even have the file permissions to. chests write the .keys to disk at close, even if they haven't changed. __delitem__ and __setitem__ both delete files even before a flush, so it might be nice to protect them from programmer errors.

Does this seem useful enough to belong in chest itself, or should I implement this on my end in a subclass or the likes?

@mrocklin
Copy link
Member

Seems useful to me

@shoyer
Copy link

shoyer commented Sep 29, 2015

You might find the Frozen utility I wrote for xray useful for this:
https://github.com/xray/xray/blob/d704524a030aef7e2029ec43d19099143b72f653/xray/core/utils.py#L233

You could use it like Frozen(Chest(...)).

@maxhutch
Copy link
Author

That avoids __delitem__ and __setitem__, but still has the problem of writings .keys on __del__.

I'll open a PR shortly.

@maxhutch maxhutch mentioned this issue Sep 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants