Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7123840
D57.id194.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
D57.id194.diff
View Options
diff --git a/swh/storage/objstorage/multiplexer/multiplexer_objstorage.py b/swh/storage/objstorage/multiplexer/multiplexer_objstorage.py
--- a/swh/storage/objstorage/multiplexer/multiplexer_objstorage.py
+++ b/swh/storage/objstorage/multiplexer/multiplexer_objstorage.py
@@ -19,6 +19,34 @@
As the ids can be differents, no pre-computed ids should be submitted.
Also, there are no guarantees that the returned ids can be used directly
into the storages that the multiplexer manage.
+
+
+ Use case examples could be:
+ Example 1:
+ storage_v1 = filter.read_only(PathSlicingObjStorage('/dir1',
+ '0:2/2:4/4:6'))
+ storage_v2 = PathSlicingObjStorage('/dir2', '0:1/0:5')
+ storage = MultiplexerObjStorage([storage_v1, storage_v2])
+
+ When using 'storage', all the new contents will only be added to the v2
+ storage, while it will be retrievable from both.
+
+ Example 2:
+ storage_v1 = filter.id_regex(
+ PathSlicingObjStorage('/dir1', '0:2/2:4/4:6'),
+ r'[^012].*'
+ )
+ storage_v2 = filter.if_regex(
+ PathSlicingObjStorage('/dir2', '0:1/0:5'),
+ r'[012]/*'
+ )
+ storage = MultiplexerObjStorage([storage_v1, storage_v2])
+
+ When using this storage, the contents with a sha1 starting with 0, 1 or
+ 2 will be redirected (read AND write) to the storage_v2, while the
+ others will be redirected to the storage_v1.
+ If a content starting with 0, 1 or 2 is present in the storage_v1, it
+ would be ignored anyway.
"""
def __init__(self, storages):
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 20 2024, 3:43 AM (11 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3216630
Attached To
D57: objstorage.multiplexer: add some use case example to the MultiplexerObjStorage main docstring
Event Timeline
Log In to Comment