Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-storage
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Platform
Development
swh-storage
Merge requests
!23
objstorage.multiplexer: add some use case example to the MultiplexerObjStorage main docstring
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
objstorage.multiplexer: add some use case example to the MultiplexerObjStorage main docstring
generated-differential-D57-source
into
generated-differential-D57-target
Overview
4
Commits
1
Pipelines
0
Changes
1
Closed
Quentin Campos
requested to merge
generated-differential-D57-source
into
generated-differential-D57-target
8 years ago
Overview
4
Commits
1
Pipelines
0
Changes
1
Expand
Migrated from D57 (
view on Phabricator
)
0
0
Merge request reports
Compare
generated-differential-D57-target
generated-differential-D57-target (base)
and
latest version
latest version
a623ce83
1 commit,
2 years ago
1 file
+
28
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
swh/storage/objstorage/multiplexer/multiplexer_objstorage.py
+
28
−
0
Options
@@ -19,6 +19,34 @@ class MultiplexerObjStorage(ObjStorage):
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
):
Loading