Skip to content

StorageAdapter«

StorageAdapter (StorageInterface) «

Storage adapter to serve as interface between object and storage proxy.

Attributes:

Name Type Description
storage_proxy StorageProxy

Storage proxy used to read and write data.

client property readonly «

Client used to communicate with storage media, ie. Path, S3Client.

root_dir: str property readonly «

Root directory to read and write objects to.

__init__(self, storage_proxy) special «

Parameters:

Name Type Description Default
storage_proxy StorageProxy

Storage proxy used to communicate with storage system.

required

delete_file(self, filename) «

Remove file from storage.

Parameters:

Name Type Description Default
filename str

Name of file, ie. image.jpeg

required

Returns:

Type Description
None

Raises StorageProxyException if error occured.

get_bytes(self, filename) «

Fetch bytes data from storage.

Parameters:

Name Type Description Default
filename str

Name of file, ie. image.jpeg

required

Returns:

Type Description
bytes

bytes data requested, raises StorageProxyException if not found.

get_json(self, filename) «

Fetch JSON data from storage.

Parameters:

Name Type Description Default
filename str

Name of file, ie. index.json

required

Returns:

Type Description
dict

JSON data requested, raises StorageProxyException if not found.

list_files(self) «

List all files in directory.

Returns:

Type Description
list

List of all paths in directory.

new_storage_proxy(self, new_root) «

Create new storage proxy for child object.

Parameters:

Name Type Description Default
new_root str

New root directory

required

Returns:

Type Description
StorageProxy

New instance of StorageProxy with new root directory.

save_bytes(self, bytes, filename) «

Save bytes data to storage.

Parameters:

Name Type Description Default
body bytes

Filename to be used to save object, ie. image.jpeg

required
filename str

Name of file, ie. index.json

required

Returns:

Type Description
None

Raises StorageProxyException if error occured.

save_json(self, body, filename) «

Save JSON data to storage.

Parameters:

Name Type Description Default
body dict

Filename to be used to save object, ie. index.json

required
filename str

Name of file, ie. index.json

required

Returns:

Type Description
None

Raises StorageProxyException if error occured.

Back to top