Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-objstorage
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-objstorage
Commits
7713724a
Commit
7713724a
authored
2 months ago
by
David Douard
Browse files
Options
Downloads
Patches
Plain Diff
Remove long-deprecated "filtered" backend
parent
dcb682dd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!210
Remove long-deprecated "filtered" backend
Pipeline
#13094
passed
1 month ago
Stage: external
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/objstorage/factory.py
+6
-26
6 additions, 26 deletions
swh/objstorage/factory.py
with
6 additions
and
26 deletions
swh/objstorage/factory.py
+
6
−
26
View file @
7713724a
...
...
@@ -4,7 +4,6 @@
# See top-level LICENSE file for more information
import
importlib
import
warnings
from
swh.objstorage.interface
import
ObjStorageInterface
from
swh.objstorage.objstorage
import
ObjStorage
...
...
@@ -28,8 +27,6 @@ OBJSTORAGE_IMPLEMENTATIONS = {
# filters and proxies
"
multiplexer
"
:
"
swh.objstorage.multiplexer.MultiplexerObjStorage
"
,
"
read-only
"
:
"
swh.objstorage.proxies.readonly.ReadOnlyProxyObjStorage
"
,
# deprecated factories
"
filtered
"
:
"
_construct_filtered_objstorage
"
,
}
...
...
@@ -55,27 +52,10 @@ def get_objstorage(cls: str, **kwargs) -> ObjStorageInterface:
%
(
cls
,
"
,
"
.
join
(
OBJSTORAGE_IMPLEMENTATIONS
))
)
if
"
.
"
in
class_path
:
(
module_path
,
class_name
)
=
class_path
.
rsplit
(
"
.
"
,
1
)
try
:
module
=
importlib
.
import_module
(
module_path
,
package
=
__package__
)
except
ImportError
as
e
:
raise
ValueError
(
f
"
Storage class
{
cls
}
is not available:
{
e
.
args
[
0
]
}
"
)
ObjStorage
=
getattr
(
module
,
class_name
)
else
:
# used by (deprecated) filtered for which the value is a factory
# function rather than a class
ObjStorage
=
globals
()[
class_path
]
(
module_path
,
class_name
)
=
class_path
.
rsplit
(
"
.
"
,
1
)
try
:
module
=
importlib
.
import_module
(
module_path
,
package
=
__package__
)
except
ImportError
as
e
:
raise
ValueError
(
f
"
Storage class
{
cls
}
is not available:
{
e
.
args
[
0
]
}
"
)
ObjStorage
=
getattr
(
module
,
class_name
)
return
ObjStorage
(
**
kwargs
)
def
_construct_filtered_objstorage
(
storage_conf
,
filters_conf
,
**
kwargs
):
if
len
(
filters_conf
)
!=
1
or
filters_conf
[
0
][
"
type
"
]
!=
"
readonly
"
:
raise
ValueError
(
"
This legacy function only supports a single readonly filter
"
)
warnings
.
warn
(
"
The
'
filtered[type:readonly]
'
objstorage class has been deprecated,
"
"
please use a
'
read-only
'
proxy class instead.
"
,
DeprecationWarning
,
)
return
get_objstorage
(
cls
=
"
read-only
"
,
storage
=
get_objstorage
(
**
storage_conf
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment