api_server_store.py 555 B

1234567891011121314
  1. """Runtime-bound API storage selection; borrowed stores are never adapter-owned."""
  2. from pathlib import Path
  3. def selected_session_db(adapter, home):
  4. from gateway.session_authorities import authority_for_home
  5. # Only a home this runtime reserved has a store here; a multiplex route alone is not proof.
  6. authority = authority_for_home(adapter.gateway_runner, home)
  7. if authority is None:
  8. return None
  9. with adapter._session_db_cache_lock:
  10. if adapter._session_db_cache_closed:
  11. return None
  12. return authority.db