Files
g0v0-server/app/storage/base.py
2025-08-12 03:58:06 +00:00

35 lines
864 B
Python

from __future__ import annotations
import abc
class StorageService(abc.ABC):
@abc.abstractmethod
async def write_file(
self,
file_path: str,
content: bytes,
content_type: str = "application/octet-stream",
cache_control: str = "public, max-age=31536000",
) -> None:
raise NotImplementedError
@abc.abstractmethod
async def read_file(self, file_path: str) -> bytes:
raise NotImplementedError
@abc.abstractmethod
async def delete_file(self, file_path: str) -> None:
raise NotImplementedError
@abc.abstractmethod
async def is_exists(self, file_path: str) -> bool:
raise NotImplementedError
@abc.abstractmethod
async def get_file_url(self, file_path: str) -> str:
raise NotImplementedError
async def close(self) -> None:
pass