Page MenuHomeSoftware Heritage

D3699.id13058.diff
No OneTemporary

D3699.id13058.diff

diff --git a/swh/storage/cassandra/storage.py b/swh/storage/cassandra/storage.py
--- a/swh/storage/cassandra/storage.py
+++ b/swh/storage/cassandra/storage.py
@@ -153,7 +153,9 @@
contents = [attr.evolve(c, ctime=now()) for c in content]
return self._content_add(list(contents), with_data=True)
- def content_update(self, content, keys=[]):
+ def content_update(
+ self, contents: List[Dict[str, Any]], keys: List[str] = []
+ ) -> None:
raise NotImplementedError(
"content_update is not supported by the Cassandra backend"
)
diff --git a/swh/storage/in_memory.py b/swh/storage/in_memory.py
--- a/swh/storage/in_memory.py
+++ b/swh/storage/in_memory.py
@@ -226,10 +226,12 @@
content = [attr.evolve(c, ctime=now()) for c in content]
return self._content_add(content, with_data=True)
- def content_update(self, content, keys=[]):
- self.journal_writer.content_update(content)
+ def content_update(
+ self, contents: List[Dict[str, Any]], keys: List[str] = []
+ ) -> None:
+ self.journal_writer.content_update(contents)
- for cont_update in content:
+ for cont_update in contents:
cont_update = cont_update.copy()
sha1 = cont_update.pop("sha1")
for old_key in self._content_indexes["sha1"][sha1]:
diff --git a/swh/storage/interface.py b/swh/storage/interface.py
--- a/swh/storage/interface.py
+++ b/swh/storage/interface.py
@@ -93,12 +93,14 @@
...
@remote_api_endpoint("content/update")
- def content_update(self, content, keys=[]):
+ def content_update(
+ self, contents: List[Dict[str, Any]], keys: List[str] = []
+ ) -> None:
"""Update content blobs to the storage. Does nothing for unknown
contents or skipped ones.
Args:
- content (iterable): iterable of dictionaries representing
+ content: iterable of dictionaries representing
individual pieces of content to update. Each dictionary has the
following keys:
diff --git a/swh/storage/storage.py b/swh/storage/storage.py
--- a/swh/storage/storage.py
+++ b/swh/storage/storage.py
@@ -236,15 +236,17 @@
@timed
@db_transaction()
- def content_update(self, content, keys=[], db=None, cur=None):
+ def content_update(
+ self, contents: List[Dict[str, Any]], keys: List[str] = [], db=None, cur=None
+ ) -> None:
# TODO: Add a check on input keys. How to properly implement
# this? We don't know yet the new columns.
- self.journal_writer.content_update(content)
+ self.journal_writer.content_update(contents)
db.mktemp("content", cur)
select_keys = list(set(db.content_get_metadata_keys).union(set(keys)))
with convert_validation_exceptions():
- db.copy_to(content, "tmp_content", select_keys, cur)
+ db.copy_to(contents, "tmp_content", select_keys, cur)
db.content_update_from_temp(keys_to_update=keys, cur=cur)
@timed

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 3, 3:30 PM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219190

Event Timeline