Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/storage.py
Show First 20 Lines • Show All 1,249 Lines • ▼ Show 20 Lines | ) -> None: | ||||
) | ) | ||||
if not authority_id: | if not authority_id: | ||||
raise StorageArgumentException(f"Unknown authority {authority}") | raise StorageArgumentException(f"Unknown authority {authority}") | ||||
fetcher_id = db.metadata_fetcher_get_id( | fetcher_id = db.metadata_fetcher_get_id( | ||||
fetcher["name"], fetcher["version"], cur | fetcher["name"], fetcher["version"], cur | ||||
) | ) | ||||
if not fetcher_id: | if not fetcher_id: | ||||
raise StorageArgumentException(f"Unknown fetcher {fetcher}") | raise StorageArgumentException(f"Unknown fetcher {fetcher}") | ||||
try: | |||||
db.origin_metadata_add( | db.origin_metadata_add( | ||||
origin_url, discovery_date, authority_id, fetcher_id, format, metadata, cur | origin_url, | ||||
discovery_date, | |||||
authority_id, | |||||
fetcher_id, | |||||
format, | |||||
metadata, | |||||
cur, | |||||
) | ) | ||||
except psycopg2.ProgrammingError as e: | |||||
raise StorageArgumentException(*e.args) | |||||
send_metric("origin_metadata:add", count=1, method_name="origin_metadata_add") | send_metric("origin_metadata:add", count=1, method_name="origin_metadata_add") | ||||
@timed | @timed | ||||
@db_transaction(statement_timeout=500) | @db_transaction(statement_timeout=500) | ||||
def origin_metadata_get( | def origin_metadata_get( | ||||
self, | self, | ||||
origin_url: str, | origin_url: str, | ||||
authority: Dict[str, str], | authority: Dict[str, str], | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |