Page MenuHomeSoftware Heritage

D7473.id27188.diff
No OneTemporary

D7473.id27188.diff

diff --git a/swh/storage/postgresql/storage.py b/swh/storage/postgresql/storage.py
--- a/swh/storage/postgresql/storage.py
+++ b/swh/storage/postgresql/storage.py
@@ -105,13 +105,32 @@
"""
def __init__(
- self, db, objstorage, min_pool_conns=1, max_pool_conns=10, journal_writer=None
+ self,
+ db,
+ objstorage,
+ min_pool_conns=1,
+ max_pool_conns=10,
+ journal_writer=None,
+ query_options=None,
):
- """
- Args:
- db_conn: either a libpq connection string, or a psycopg2 connection
- obj_root: path to the root of the object storage
-
+ """Args:
+ db: either a libpq connection string, or a psycopg2 connection
+ objstorage: configuration for the backend objstorage
+ min_pool_conns: min number of connections in the psycopg pool
+ max_pool_conns: max number of connections in the psycopg pool
+ journal_writer: configuration for the journal (JournalWriter)
+ query_options: configuration for the sql connections; keys of
+ the dict are the method names decorated with @db_transaction
+ or @db_transaction_generator (eg. content_find), and values are
+ dicts (config_name, config_value) used to configure the sql connection
+ for the method_name. For example, using::
+
+ { "content_get": {"statement_timeout": 5000}}
+
+ will overwrite the default statement timeout for the content_get
+ endpoint from 500ms to 5000ms.
+
+ See swh.core.db.common for more details.
"""
try:
if isinstance(db, psycopg2.extensions.connection):
@@ -127,9 +146,9 @@
self._db = None
except psycopg2.OperationalError as e:
raise StorageDBError(e)
-
self.journal_writer = JournalWriter(journal_writer)
self.objstorage = ObjStorage(objstorage)
+ self.query_options = query_options
def get_db(self):
if self._db:

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 3, 3:48 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3234509

Event Timeline