ontocast.api.tenancy_resolution¶
Shared HTTP request tenancy resolution for API routes.
apply_request_tenancy(request, tools, *, active_tenant, active_project, initialize_vector_store)
async
¶
Resolve tenant/project and return the ToolBox that serves that partition.
If tenant or project appears in the query string, resolve with
defaults and hand back a ToolBox bound to that scope; otherwise return the
startup ToolBox and the active_* scope unchanged.
This used to retarget the shared ToolBox in place, so every request
mutated process-wide state -- dataset names, collection names, the ontology
catalog -- behind a single lock that serialized all multi-tenant traffic.
Now each scope owns a ToolBox (over a deep-copied Config, sharing the
expensive runtime), so isolation is structural and different tenants run
concurrently.
Returns:
| Type | Description |
|---|---|
ToolBox
|
|
str
|
passed in, for everything downstream of this call. |
Source code in ontocast/api/tenancy_resolution.py
stores_use_tenancy_partitions(tools)
¶
True when triple store and/or Qdrant should be retargeted for tenant/project.