feat(storage): add local storage framework
This commit is contained in:
parent
228da8f814
commit
964b545bc5
24 changed files with 890 additions and 98 deletions
34
backend/hermes/app/storage/base.py
Normal file
34
backend/hermes/app/storage/base.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue