Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9311520
__init__.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
992 B
Subscribers
None
__init__.py
View Options
# Copyright (C) 2015-2016 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from
.
import
storage
Storage
=
storage
.
Storage
def
get_storage
(
cls
,
args
):
"""
Get a storage object of class `storage_class` with arguments
`storage_args`.
Args:
storage (dict): dictionary with keys:
- cls (str): storage's class, either 'local' or 'remote'
- args (dict): dictionary with keys
Returns:
an instance of swh.storage.Storage (either local or remote)
Raises:
ValueError if passed an unknown storage class.
"""
if
cls
==
'remote'
:
from
.api.client
import
RemoteStorage
as
Storage
elif
cls
==
'local'
:
from
.storage
import
Storage
else
:
raise
ValueError
(
'Unknown storage class `
%s
`'
%
cls
)
return
Storage
(
**
args
)
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Thu, Jul 3, 10:19 AM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3240727
Attached To
rDSTOC swh-storage-cassandra
Event Timeline
Log In to Comment