Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/cassandra/cql.py
Show First 20 Lines • Show All 1,120 Lines • ▼ Show 20 Lines | class CqlRunner: | ||||
) -> Iterable[RawExtrinsicMetadataRow]: | ) -> Iterable[RawExtrinsicMetadataRow]: | ||||
return map( | return map( | ||||
RawExtrinsicMetadataRow.from_dict, | RawExtrinsicMetadataRow.from_dict, | ||||
self._execute_with_retries( | self._execute_with_retries( | ||||
statement, [target, authority_url, authority_type] | statement, [target, authority_url, authority_type] | ||||
), | ), | ||||
) | ) | ||||
@_prepared_statement( | |||||
"SELECT authority_type, authority_url FROM raw_extrinsic_metadata " | |||||
"WHERE target = ?" | |||||
) | |||||
def raw_extrinsic_metadata_get_authorities( | |||||
self, target: str, *, statement | |||||
) -> Iterable[Tuple[str, str]]: | |||||
return ( | |||||
(entry["authority_type"], entry["authority_url"]) | |||||
for entry in self._execute_with_retries(statement, [target]) | |||||
) | |||||
########################## | ########################## | ||||
# 'extid' table | # 'extid' table | ||||
########################## | ########################## | ||||
def _extid_add_finalize(self, statement: BoundStatement) -> None: | def _extid_add_finalize(self, statement: BoundStatement) -> None: | ||||
"""Returned currified by extid_add_prepare, to be called when the | """Returned currified by extid_add_prepare, to be called when the | ||||
extid row should be added to the primary table.""" | extid row should be added to the primary table.""" | ||||
self._execute_with_retries(statement, None) | self._execute_with_retries(statement, None) | ||||
self._increment_counter("extid", 1) | self._increment_counter("extid", 1) | ||||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |