settings_store.py 724 B

12345678910111213141516171819202122232425
  1. from __future__ import annotations
  2. from abc import ABC, abstractmethod
  3. from openhands.core.config.app_config import AppConfig
  4. from openhands.server.settings import Settings
  5. class SettingsStore(ABC):
  6. """
  7. Storage for SessionInitData. May or may not support multiple users depending on the environment
  8. """
  9. @abstractmethod
  10. async def load(self) -> Settings | None:
  11. """Load session init data"""
  12. @abstractmethod
  13. async def store(self, settings: Settings):
  14. """Store session init data"""
  15. @classmethod
  16. @abstractmethod
  17. async def get_instance(cls, config: AppConfig, token: str | None) -> SettingsStore:
  18. """Get a store for the user represented by the token given"""