Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/cassandra/storage.py
Show First 20 Lines • Show All 1,065 Lines • ▼ Show 20 Lines | ) -> None: | ||||
raise StorageArgumentException( | raise StorageArgumentException( | ||||
"origin_id must be str, not %r" % (origin_url,) | "origin_id must be str, not %r" % (origin_url,) | ||||
) | ) | ||||
if not self._cql_runner.metadata_authority_get(**authority): | if not self._cql_runner.metadata_authority_get(**authority): | ||||
raise StorageArgumentException(f"Unknown authority {authority}") | raise StorageArgumentException(f"Unknown authority {authority}") | ||||
if not self._cql_runner.metadata_fetcher_get(**fetcher): | if not self._cql_runner.metadata_fetcher_get(**fetcher): | ||||
raise StorageArgumentException(f"Unknown fetcher {fetcher}") | raise StorageArgumentException(f"Unknown fetcher {fetcher}") | ||||
try: | |||||
self._cql_runner.origin_metadata_add( | self._cql_runner.origin_metadata_add( | ||||
origin_url, | origin_url, | ||||
authority["type"], | authority["type"], | ||||
authority["url"], | authority["url"], | ||||
discovery_date, | discovery_date, | ||||
fetcher["name"], | fetcher["name"], | ||||
fetcher["version"], | fetcher["version"], | ||||
format, | format, | ||||
metadata, | metadata, | ||||
) | ) | ||||
except TypeError as e: | |||||
raise StorageArgumentException(*e.args) | |||||
def origin_metadata_get( | def origin_metadata_get( | ||||
self, | self, | ||||
origin_url: str, | origin_url: str, | ||||
authority: Dict[str, str], | authority: Dict[str, str], | ||||
after: Optional[datetime.datetime] = None, | after: Optional[datetime.datetime] = None, | ||||
limit: Optional[int] = None, | limit: Optional[int] = None, | ||||
) -> List[Dict[str, Any]]: | ) -> List[Dict[str, Any]]: | ||||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |