Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/storage/in_memory.py
Show First 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | def __init__(self): | ||||
OriginIntrinsicMetadataRow, self._tools | OriginIntrinsicMetadataRow, self._tools | ||||
) | ) | ||||
def check_config(self, *, check_write): | def check_config(self, *, check_write): | ||||
return True | return True | ||||
def content_mimetype_missing( | def content_mimetype_missing( | ||||
self, mimetypes: Iterable[Dict] | self, mimetypes: Iterable[Dict] | ||||
) -> Iterator[Tuple[Sha1, int]]: | ) -> Iterable[Tuple[Sha1, int]]: | ||||
yield from self._mimetypes.missing(mimetypes) | yield from self._mimetypes.missing(mimetypes) | ||||
def content_mimetype_get_partition( | def content_mimetype_get_partition( | ||||
self, | self, | ||||
indexer_configuration_id: int, | indexer_configuration_id: int, | ||||
partition_id: int, | partition_id: int, | ||||
nb_partitions: int, | nb_partitions: int, | ||||
page_token: Optional[str] = None, | page_token: Optional[str] = None, | ||||
limit: int = 1000, | limit: int = 1000, | ||||
) -> PagedResult[Sha1]: | ) -> PagedResult[Sha1]: | ||||
return self._mimetypes.get_partition( | return self._mimetypes.get_partition( | ||||
indexer_configuration_id, partition_id, nb_partitions, page_token, limit | indexer_configuration_id, partition_id, nb_partitions, page_token, limit | ||||
) | ) | ||||
def content_mimetype_add( | def content_mimetype_add( | ||||
self, mimetypes: List[ContentMimetypeRow], conflict_update: bool = False | self, mimetypes: List[ContentMimetypeRow], conflict_update: bool = False | ||||
) -> Dict[str, int]: | ) -> Dict[str, int]: | ||||
added = self._mimetypes.add(mimetypes, conflict_update) | added = self._mimetypes.add(mimetypes, conflict_update) | ||||
return {"content_mimetype:add": added} | return {"content_mimetype:add": added} | ||||
def content_mimetype_get(self, ids: Iterable[Sha1]) -> Iterator[ContentMimetypeRow]: | def content_mimetype_get(self, ids: Iterable[Sha1]) -> Iterable[ContentMimetypeRow]: | ||||
yield from self._mimetypes.get(ids) | yield from self._mimetypes.get(ids) | ||||
def content_language_missing(self, languages): | def content_language_missing(self, languages): | ||||
yield from self._languages.missing(languages) | yield from self._languages.missing(languages) | ||||
def content_language_get(self, ids): | def content_language_get(self, ids): | ||||
yield from (obj.to_dict() for obj in self._languages.get(ids)) | yield from (obj.to_dict() for obj in self._languages.get(ids)) | ||||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |