Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/cassandra/cql.py
Show First 20 Lines • Show All 453 Lines • ▼ Show 20 Lines | ) -> Iterable[Tuple[int, ContentRow]]: | ||||
(row["tok"], ContentRow.from_dict(remove_keys(row, ("tok",)))) | (row["tok"], ContentRow.from_dict(remove_keys(row, ("tok",)))) | ||||
for row in self._execute_with_retries(statement, [start, end, limit]) | for row in self._execute_with_retries(statement, [start, end, limit]) | ||||
) | ) | ||||
########################## | ########################## | ||||
# 'content_by_*' tables | # 'content_by_*' tables | ||||
########################## | ########################## | ||||
@_prepared_statement( | |||||
f""" | |||||
SELECT sha1_git AS id | |||||
FROM {content_index_table_name("sha1_git", skipped_content=False)} | |||||
WHERE sha1_git IN ? | |||||
""" | |||||
) | |||||
def content_missing_by_sha1_git( | |||||
self, ids: List[bytes], *, statement | |||||
) -> List[bytes]: | |||||
return self._missing(statement, ids) | |||||
def content_index_add_one(self, algo: str, content: Content, token: int) -> None: | def content_index_add_one(self, algo: str, content: Content, token: int) -> None: | ||||
"""Adds a row mapping content[algo] to the token of the Content in | """Adds a row mapping content[algo] to the token of the Content in | ||||
the main 'content' table.""" | the main 'content' table.""" | ||||
query = f""" | query = f""" | ||||
INSERT INTO {content_index_table_name(algo, skipped_content=False)} | INSERT INTO {content_index_table_name(algo, skipped_content=False)} | ||||
({algo}, target_token) | ({algo}, target_token) | ||||
VALUES (%s, %s) | VALUES (%s, %s) | ||||
""" | """ | ||||
▲ Show 20 Lines • Show All 970 Lines • Show Last 20 Lines |