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

kv_walk: docs, tests, tools, and recipes #2

Open
thorwhalen opened this issue Sep 3, 2021 · 2 comments
Open

kv_walk: docs, tests, tools, and recipes #2

thorwhalen opened this issue Sep 3, 2021 · 2 comments

Comments

@thorwhalen
Copy link
Member

thorwhalen commented Sep 3, 2021

Tools ideas

add_path_get and path.KeyPath are useful to get a "flat read access" from nested stores, but it's just for getting data: It's not enough to get a full KvReader (needs iter, len, contains) or KvPersister (needs del and set). kv_walk is relevant there. One could imagine a dol.trans.store_decorator that takes the same arguments as kv_walk (or a "kv_walker" object), and decorates the store in such a way as to offer a store whose keys are the paths of the kv_walk.

Related to the "flat stores" is this issue on hypercubic keys and issue on subscripting abilities.

dol.filesys deals with file/folder traversal with max_levels and isdir/isfile only, and these are somewhat baked in the code. One could envision a future for dol.filesys that would offer the same functionality, but also more, expanding the tree traversal aspects to anything involving path, key and value.

Other

Can see applications of remap for inspiration of applications.

┆Issue is synchronized with this Asana task by Unito

@thorwhalen
Copy link
Member Author

Just pushed a flattener: Made it in dol, here:

dol/dol/trans.py

Line 2193 in 4c51648

def flatten(store=None, *, levels=None, cache_keys=False):

Note: It doesn't allow flat WRITES or DELETES. Just reads.

@thorwhalen
Copy link
Member Author

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

1 participant