Skip to content

feat: dol.path_of(store, key) (#158) - #160

Merged
thorwhalen merged 2 commits into
masterfrom
files-path-of-158
Oct 26, 2026
Merged

thorwhalen merged 2 commits into
masterfrom
files-path-of-158

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

Closes #158

Adds dol.path_of(store, key): the file-system path of key in a file-backed store, however wrapped. It follows every layer's _id_of_key (the existing inner_most_key walk) to the innermost FileSysCollection, validates the result there (a key leaving rootdir raises KeyValidationError, a KeyError), and raises TypeError when the core is not a file store. Nothing is read or created.

Design note: a free function rather than a Files.path_of method, deliberately. Store.__getattr__ forwards unknown attributes to the inner store with the outer key unmapped (the #83 trap), so a method propagated through wrap_kvs would silently return a wrong path. The function needs no propagation, works for any stacking, and is purely additive. xdol can default its path_of= to it.

Tests: dol/tests/test_filesys.py::test_path_of_follows_wrappers_and_validates + doctests.

@thorwhalen
thorwhalen merged commit 63993cf into master Oct 26, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the files-path-of-158 branch October 26, 2026 15:43
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

Successfully merging this pull request may close these issues.

dol.Files: public path-for-key accessor, propagated through wrap_kvs

1 participant