34 lines
862 B
Python
34 lines
862 B
Python
from abc import ABC, abstractmethod
|
|
from pathlib import Path
|
|
|
|
from app.storage.schemas import FileMetadata, StoredFileMetadata
|
|
|
|
|
|
class StorageProvider(ABC):
|
|
@abstractmethod
|
|
def save_file(
|
|
self,
|
|
*,
|
|
namespace: str,
|
|
content: bytes,
|
|
original_filename: str,
|
|
stored_filename: str,
|
|
mime_type: str,
|
|
) -> StoredFileMetadata:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def open_file(self, storage_key: str) -> Path:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def delete_file(self, storage_key: str) -> None:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def file_exists(self, storage_key: str) -> bool:
|
|
raise NotImplementedError
|
|
|
|
@abstractmethod
|
|
def get_file_metadata(self, storage_key: str) -> FileMetadata:
|
|
raise NotImplementedError
|