sams.storage.providers.base – Base Storage Provider¶
Storage Provider base is a…..
The sams.storage.providers.base package provides storage io implementations.
-
class
SamsBaseStorageProvider(config_string: str)¶ An instance of SamsBaseStorageProvider
-
process_config_string(config_string: str)¶ Extract relevant information from the provided
config_string- Parameters
config_string (str) – A string from any
STORAGE_DESTINATIONconfig attribute- Raises
ValueError – If there
-
exists(media_id: Union[bson.objectid.ObjectId, str]) → bool¶ Checks if a file exists in the storage destination
This method must be defined in the derived class
- Parameters
media_id – The ID of the asset
- Returns
Trueif a matching file exists,Falseotherwise- Raises
NotImplementedError – If not defined in derived class
-
put(content: Union[BinaryIO, str], filename: str, mimetype: Optional[str] = None) → str¶ Upload a file to the storage destination
content must be an instance of
bytesor a file-like object providing aread()method.This method must be defined in the derived class
- Parameters
- Returns
The
"id"of the created file- Raises
NotImplementedError – If not defined in derived class
-
get(media_id: Union[bson.objectid.ObjectId, str]) → superdesk.storage.superdesk_file.SuperdeskFile¶ Get an asset from the storage
This method must be defined in the derived class
- Parameters
media_id – The ID of the asset
- Returns
- Raises
NotImplementedError – If not defined in derived class
-
delete(media_id: Union[bson.objectid.ObjectId, str])¶ Delete as asset from the storage
This method must be defined in the derived class
- Parameters
media_id – The ID of the asset
- Raises
NotImplementedError – If not defined in derived class
-
drop()¶ Deletes all assets from the storage
This method must be defined in the derived class
- Raises
NotImplementedError – If not defined in derived class
-