Check for uniqueness of names also across the file storage
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 394
- Forks
- 95
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 7
Description
TLDR;
When #398 is addressed, we can remove _check_element_not_on_disk_with_different_type() as it will not be needed anymore.
Full issue
When adding an element in-memory to a SpatialData object, the mechanism around self._shared_keys in Elements doesn't check (by design) if an on-disk an element with the same name is already available. This gives the user more flexibility when replacing an element on-disk with a new one in-memory.
Nevertheless, due the fact that we assume unique names for objects of different types, the above in-memory check doesn't guarantee that with the new incremental IO APIs the user doesn't add on-disk an element that is already present with the same name in another group. For instance on disk there would be images/my_image, the user could have in-memory only labels/my_image and save it on disk. This would make the object corrupted.
Currently I perform the check that the element name that is being added/deleted/changed (metadata, transformations) doesn't refer to an element on-disk with a different type with _check_element_not_on_disk_with_different_type(). Anyway, in general I believe that we should not complicate the code with these checks and address the problem at the root by fixing https://github.com/scverse/spatialdata/issues/398.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading issue #398, then inspect the Elements mechanism around self._shared_keys and _check_element_not_on_disk_with_different_type(). The work is done when incremental IO prevents duplicate names across on-disk groups and the obsolete type-check helper can be removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data, databases
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100