federated-storage/middleware/app_be/services/StorageServiceInterface.py

63 lines
1.6 KiB
Python

class StorageServiceInterface:
name = "StorageServiceInterface"
@staticmethod
def get_last_modified(filename: str):
"""Get last modified time of file
:param filename: filename
:return: Date of last modification or None
"""
pass
@staticmethod
def check() -> bool:
pass
@staticmethod
def create_file(filename: str, file: bytes) -> bool:
"""Create / save (or overwrite) an file on the storage.
:param filename: filename
:param file: bytes representation of the file
:return: Whether file was successfully uploaded
"""
pass
@staticmethod
def read_file(filename: str) -> bytes:
"""Read file on the storage.
:param filename: filename
:return: bytes representation of the file or None on error
"""
pass
@staticmethod
def update_file(filename: str, file: bytes) -> bool:
"""Update (currently: overwrite) an file on the storage.
:param filename: filename of the file
:param file: bytes representation of the file
:return: Whether file was successfully uploaded
"""
pass
@staticmethod
def delete_file(filename: str) -> bool:
"""Delete an file from the storage.
:param filename: filename of the file
:return: Whether file was successfully deleted
"""
pass
@staticmethod
def delete_all() -> bool:
"""Delete every file from the storage.
:return: Whether the storage was successfully emptied
"""
pass