BaseObjectStorage

class BaseObjectStorage(ABC):

object_exists

def object_exists(self, file_path: PurePath):

Check if the object exists in the storage.

Parameters:

  • file_path (PurePath): The path to the object in the storage.

Returns:

bool: True if the object exists, False otherwise.

canonicalize_path

def canonicalize_path(file_path: PurePath):

put_file

def put_file(self, file_path: PurePath, file: File):

Put a file to the object storage.

Parameters:

  • file_path (PurePath): The path to the object in the storage.
  • file (File): The file to be put.

get_file

def get_file(self, file_path: PurePath):

Get a file from the object storage.

Parameters:

  • file_path (PurePath): The path to the object in the storage.

Returns:

File: The file object get from the storage.

upload_file

def upload_file(self, local_file_path: Path, remote_file_path: PurePath):

Upload a local file to the object storage.

Parameters:

  • local_file_path (Path): The path to the local file to be uploaded.
  • remote_file_path (PurePath): The path to the object in storage.

download_file

def download_file(self, local_file_path: Path, remote_file_path: PurePath):

Download a file from the object storage to the local system.

Parameters:

  • local_file_path (Path): The path to the local file to be saved.
  • remote_file_path (PurePath): The path to the object in storage.

_put_file

def _put_file(self, file_key: str, file: File):

_get_file

def _get_file(self, file_key: str, filename: str):

_object_exists

def _object_exists(self, file_key: str):

_upload_file

def _upload_file(self, local_file_path: Path, remote_file_key: str):

_download_file

def _download_file(self, local_file_path: Path, remote_file_key: str):