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

Directory and inheritance structure of storage backends #6607

Open
GeigerJ2 opened this issue Nov 12, 2024 · 1 comment
Open

Directory and inheritance structure of storage backends #6607

GeigerJ2 opened this issue Nov 12, 2024 · 1 comment

Comments

@GeigerJ2
Copy link
Contributor

GeigerJ2 commented Nov 12, 2024

As noted with @rabbull, all ORM entities for the SQLite backends are contained in storage/sqlite_zip/orm.py, while the other SQLite-based storage backends then import from there, e.g.:

from aiida.storage.sqlite_zip import models, orm

While it's not critical, functionality-wise, we could still consider a refactor, as it's a bit confusing that everything sqlite ORM related is contained under sqlite_zip, while sqlite_dos and sqlite_temp are actually implemented in directories at the same level, so one would expect those to stand on equal footing.

Similarly, I wouldn't actually have expected the SqliteDosStorage to inherit from PsqlDosBackend, but rather both of them to have a common parent class, or using composition? Wondering if there was a reason for this structure when the SqliteDosStorage was implemented in #6148. I guess this is mainly historical? Pinging also @unkcpz preaching "composition over inheritance" :D

@unkcpz
Copy link
Member

unkcpz commented Nov 13, 2024

I think it is also a great place to use python protocol for duck typing. If there have N database backend and M file-repository backend, we don't want to end up with NxM storage backend.
We can have a discuss on coding week and see how to initialize the work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants