Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9125548
D1363.id4363.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D1363.id4363.diff
View Options
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
@@ -169,7 +169,7 @@
"""
return self._content_add(contents, with_data=False)
- def content_get(self, ids):
+ def content_get(self, ids, start=0, end=-1):
"""Retrieve in bulk contents and their data.
This function may yield more blobs than provided sha1 identifiers,
@@ -201,7 +201,10 @@
yield None
continue
- yield {'sha1': obj_id, 'data': data}
+ if end != -1:
+ yield {'sha1': obj_id, 'data': data[start:end]}
+ else:
+ yield {'sha1': obj_id, 'data': data}
def content_get_range(self, start, end, limit=1000, db=None, cur=None):
"""Retrieve contents within range [start, end] bound by limit.
diff --git a/swh/storage/storage.py b/swh/storage/storage.py
--- a/swh/storage/storage.py
+++ b/swh/storage/storage.py
@@ -334,7 +334,7 @@
return summary
- def content_get(self, content):
+ def content_get(self, content, start=0, end=-1):
"""Retrieve in bulk contents and their data.
This generator yields exactly as many items than provided sha1
@@ -369,7 +369,10 @@
yield None
continue
- yield {'sha1': obj_id, 'data': data}
+ if end != -1:
+ yield {'sha1': obj_id, 'data': data[start:end]}
+ else:
+ yield {'sha1': obj_id, 'data': data}
@db_transaction()
def content_get_range(self, start, end, limit=1000, db=None, cur=None):
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jun 20, 9:03 PM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3230187
Attached To
D1363: Add support for slices in Storage.content_get (T1446)
Event Timeline
Log In to Comment