Make Storage, Db, and tests more modular.
To prepare for a new backend that doesn't use postgresql. First step toward #1306 (closed).
Test Plan
'tox' still runs the same tests, and doesn't fail.
Migrated from D631 (view on Phabricator)
Merge request reports
Activity
Build is green See https://jenkins.softwareheritage.org/job/DSTO/job/tox/30/ for more details.
Build is green See https://jenkins.softwareheritage.org/job/DSTO/job/tox/31/ for more details.
209 # elif self.cur is not None: 210 # return self.cur 211 else: 212 return self.conn.cursor() 213 214 def __init__(self, conn, pool=None): 215 """create a DB proxy 216 217 Args: 218 conn: psycopg2 connection to the SWH DB 219 pool: psycopg2 pool of connections 220 221 """ 222 self.conn = conn 223 self.pool = pool 224 That will need a bump in storage and migration in other modules:
./swh-vault/.tox/py3/lib/python3.6/site-packages/swh/storage/tests/test_db.py:13:from swh.storage.db import Db ./swh-indexer/.tox/py3/lib/python3.6/site-packages/swh/storage/tests/test_db.py:13:from swh.storage.db import Db ./swh-storage/swh/storage/tests/test_db.py:13:from swh.storage.db import Db ./swh-lister/.tox/py3/lib/python3.6/site-packages/swh/storage/tests/test_db.py:13:from swh.storage.db import Db ./swh-journal/.tox/py3/lib/python3.6/site-packages/swh/storage/tests/test_db.py:13:from swh.storage.db import Db
304 267 305 268 @db_transaction_generator() 306 269 def skipped_content_missing(self, content, db=None, cur=None): 307 """List skipped_content missing from storage 270 """List skipped_content missing from storage, ie. content 271 that is known by the archive but not stored for some reason - Really move all pgsql-specific parts of Storage into PgStorage.
- Apply @ardumont's comment
Build is green See https://jenkins.softwareheritage.org/job/DSTO/job/tox/32/ for more details.
Build is green See https://jenkins.softwareheritage.org/job/DSTO/job/tox/33/ for more details.
Build is green See https://jenkins.softwareheritage.org/job/DSTO/job/tox/34/ for more details.
Build is green See https://jenkins.softwareheritage.org/job/DSTO/job/tox/35/ for more details.
Abandonned in favor of !110 (closed).
mentioned in merge request !110 (closed)