Files

27 lines
818 B
Python

"""Persistence contract for the global upload policy document."""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Any
class UploadPolicyStore(ABC):
@abstractmethod
async def ensure_seed(self, policy: dict[str, Any]) -> dict[str, Any]:
"""Create the default row if missing without overwriting saved edits."""
raise NotImplementedError
@abstractmethod
async def get_policy(self) -> dict[str, Any] | None:
"""Return the stored policy, or ``None`` before the first save."""
raise NotImplementedError
@abstractmethod
async def set_policy(self, policy: dict[str, Any], *, updated_by: str | None = None) -> dict[str, Any]:
"""Atomically replace the global policy document."""
raise NotImplementedError