feat(01-04): add StorageBackend ABC + MinIOBackend + factory

- backend/storage/base.py: StorageBackend ABC with 5 abstract methods mirroring ai/base.py
- backend/storage/minio_backend.py: MinIOBackend wrapping all sync Minio SDK calls in asyncio.to_thread(); STORE-02 key schema: {user_id}/{document_id}/{uuid4()}{ext}
- backend/storage/__init__.py: get_storage_backend() factory mirroring ai/__init__.py
- backend/tests/test_storage.py: remove xfail markers (plan 04 implements the module)
This commit is contained in:
curo1305
2026-05-22 09:36:24 +02:00
parent e822a8f4b1
commit eaf86a832a
4 changed files with 187 additions and 6 deletions
+27
View File
@@ -0,0 +1,27 @@
"""
Storage backend factory for DocuVault.
Mirrors backend/ai/__init__.py — exposes a get_storage_backend() factory
that returns the configured StorageBackend implementation.
Phase 1 always returns MinIOBackend. Phase 5 will extend this factory to
support OneDrive, Google Drive, Nextcloud, and WebDAV backends.
"""
from storage.base import StorageBackend
from storage.minio_backend import MinIOBackend
from config import settings
def get_storage_backend() -> StorageBackend:
"""Return a MinIOBackend instance configured from config.settings.
secure=False is correct for Docker internal HTTP traffic between containers
(RESEARCH.md Pattern 3).
"""
return MinIOBackend(
endpoint=settings.minio_endpoint,
access_key=settings.minio_access_key,
secret_key=settings.minio_secret_key,
bucket=settings.minio_bucket,
secure=False,
)