-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ REFACTOR: Move archive backend to
aiida/storage
(#5375)
This PR moves the archive storage backend implementation (`sqlite_zip`) into `aiida/storage` alongside the "main" `psql_dos` backend. It includes both the storage reading and migration functionality. Inline with this synchronisation of the archive and the storage backend: - A number of the archive specific exceptions have been replaced with general storage ones: - `UnreadableArchiveError`/`CorruptArchive` -> `CorruptStorage` - `IncompatibleArchiveVersionError` -> `IncompatibleStorageSchema` - `ArchiveMigrationError` -> `StorageMigrationError` - `ArchiveClosedError` -> `ClosedStorage` - `MIGRATE_LOGGER` has been moved to `aiida/storage/log.py` - `verdi archive inspect` has been deprecated and replaced by `verdi archive version` and `verdi archive info`, to bring it inline with `verdi storage`. alembic migrations have been added to the `sqlite_zip` migration logic, to support future migrations of the sqlite database. Alongside this, the non-null restrictions for legacy archive fields have been relaxed, to improve robustness. Subsequent migrations have been added; first, to replace any existing (unwanted) null values with default values, then to modify the schema to re-add the non-null constraints. Finally, additional tests have been put in place (in `tests/tools/archive/test_schema.py`), to ensure that the sqlite schema is always synchronised with the postgresql schema.
- Loading branch information
1 parent
09765ec
commit bc9ae71
Showing
106 changed files
with
2,562 additions
and
1,467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# -*- coding: utf-8 -*- | ||
########################################################################### | ||
# Copyright (c), The AiiDA team. All rights reserved. # | ||
# This file is part of the AiiDA code. # | ||
# # | ||
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core # | ||
# For further information on the license, see the LICENSE.txt file # | ||
# For further information please visit http://www.aiida.net # | ||
########################################################################### | ||
"""Module with implementation of the storage backend, | ||
using an SQLite database and repository files, within a zipfile. | ||
The content of the zip file is:: | ||
|- storage.zip | ||
|- metadata.json | ||
|- db.sqlite3 | ||
|- repo/ | ||
|- hashkey1 | ||
|- hashkey2 | ||
... | ||
For quick access, the metadata (such as the version) is stored in a `metadata.json` file, | ||
at the "top" of the zip file, with the sqlite database, just below it, then the repository files. | ||
Repository files are named by their SHA256 content hash. | ||
This storage method is primarily intended for the AiiDA archive, | ||
as a read-only storage method. | ||
This is because sqlite and zip are not suitable for concurrent write access. | ||
The archive format originally used a JSON file to store the database, | ||
and these revisions are handled by the `version_profile` and `migrate` backend methods. | ||
""" |
Oops, something went wrong.