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

Implement N5Store as a transformation layer over other stores #410

Open
alimanfoo opened this issue Feb 25, 2019 · 4 comments
Open

Implement N5Store as a transformation layer over other stores #410

alimanfoo opened this issue Feb 25, 2019 · 4 comments

Comments

@alimanfoo
Copy link
Member

The current work on an N5Store in #309 implements a storage class that does two things. First, it implements a transformation from the keys and values used in the zarr protocol into keys and values used in the N5 protocol. It then also implements storage of keys and values as files on a file system.

It would be possible to separate these concerns, such that the N5Store just implemented the protocol transformation, and then delegated the actual storage or retrieval of N5 keys and values from an inner store. This would mean that the N5Store class could be used with file systems or cloud stores or any form of key/value storage.

E.g., what is currently now:

store = zarr.N5Store('/path/to/store.n5')

...could become a shorthand for:

store = zarr.N5Store(zarr.DirectoryStore('/path/to/store.n5'))

...and other inner stores could be used, e.g.:

from gcsfs import GCSMap
store = zarr.N5Store(GCSMap('my-bucket', ...))

Internally, to make this possible, the N5Store class would replace all the logic for opening, reading or writing files with calls to inner.__getitem__(key) and inner.__setitem__(key, value) where inner is the inner store wrapped by the N5Store class.

@alimanfoo alimanfoo mentioned this issue Feb 25, 2019
11 tasks
@jakirkham
Copy link
Member

jakirkham commented Feb 26, 2019

Thanks for writing this up.

Would add that this is also true of NestedDirectoryStore, which N5Store currently relies on. If we change N5Store into a transformational layer, we may want to do something similar with NestedDirectoryStore. ( #395 )

@alimanfoo
Copy link
Member Author

alimanfoo commented Feb 26, 2019 via email

@jakirkham
Copy link
Member

As far as naming these classes that are not quite stores, what should we call them?

  1. ...Store
  2. ...Layer
  3. ...Transformer
  4. ?

@alimanfoo
Copy link
Member Author

As far as naming these classes that are not quite stores, what should we call them?

  1. ...Store
  2. ...Layer
  3. ...Transformer
  4. ?

Good question. I guess ...StoreTransformer would be the most descriptive, but also the most verbose. I'd be happy with just ...Store too.

xref zarr-developers/zarr-specs#8

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

2 participants