""" StorageBackend ABC for DocuVault. Mirrors backend/ai/base.py — declares the abstract interface that all storage backends (MinIO, OneDrive, Google Drive, Nextcloud, WebDAV) must implement. Five abstract methods define the contract: put_object — store bytes, return object key get_object — fetch bytes by key delete_object — remove object by key presigned_get_url — generate a time-limited download URL health_check — verify backend connectivity """ from abc import ABC, abstractmethod class StorageBackend(ABC): """Abstract base class for DocuVault object storage backends.""" @abstractmethod async def put_object( self, user_id: str, document_id: str, file_bytes: bytes, extension: str, content_type: str, ) -> str: """Store bytes and return the generated object key. The key MUST follow the STORE-02 schema: {user_id}/{document_id}/{uuid4()}{ext}. The human-readable filename MUST NOT appear in the returned key. """ ... @abstractmethod async def get_object(self, object_key: str) -> bytes: """Fetch object bytes by key. Raises on missing key.""" ... @abstractmethod async def delete_object(self, object_key: str) -> None: """Delete an object by key. No-op if the key does not exist.""" ... @abstractmethod async def presigned_get_url(self, object_key: str, expires_minutes: int = 60) -> str: """Return a time-limited pre-signed download URL for the object.""" ... @abstractmethod async def health_check(self) -> bool: """Return True if the backend is reachable and operational.""" ...