INNER CODE UNIT · Python

get_storage_usage

caipe-io/ai-platform-engineering · ai_platform_engineering/audit_service/main.py:376

    async def get_storage_usage(request: Request) -> dict[str, Any]:
        store = request.app.state.audit_store
        current_settings: Settings = request.app.state.audit_settings
        if isinstance(store, LocalAuditStore):
            audit_bytes = await asyncio.to_thread(store.audit_dir_bytes)
            return {
                "backend": "local",
                "audit_bytes": audit_bytes,
                "audit_bytes_human": _format_bytes_local(audit_bytes),
                "local_path": current_settings.local_path,
                "retention_days": current_settings.local_retention_days,
            }
        if isinstance(store, S3AuditStore):
            usage = await asyncio.to_thread(store.storage_usage)
            return {
                "backend": "s3",
                **usage,
                "bucket": current_settings.s3_bucket,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…