Changeset View
Changeset View
Standalone View
Standalone View
swh/scrubber/db.py
Show All 39 Lines | |||||
class FixedObject: | class FixedObject: | ||||
id: CoreSWHID | id: CoreSWHID | ||||
object_: bytes | object_: bytes | ||||
method: str | method: str | ||||
recovery_date: Optional[datetime.datetime] = None | recovery_date: Optional[datetime.datetime] = None | ||||
class ScrubberDb(BaseDb): | class ScrubberDb(BaseDb): | ||||
current_version = 1 | current_version = 2 | ||||
@functools.lru_cache(1000) | @functools.lru_cache(1000) | ||||
def datastore_get_or_add(self, datastore: Datastore) -> int: | def datastore_get_or_add(self, datastore: Datastore) -> int: | ||||
"""Creates a datastore if it does not exist, and returns its id.""" | """Creates a datastore if it does not exist, and returns its id.""" | ||||
cur = self.cursor() | cur = self.cursor() | ||||
cur.execute( | cur.execute( | ||||
""" | """ | ||||
WITH inserted AS ( | WITH inserted AS ( | ||||
▲ Show 20 Lines • Show All 264 Lines • Show Last 20 Lines |