cayu.storage.application
Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.
ApplicationStores
Section titled “ApplicationStores”from cayu import ApplicationStoresThe stores selected by open_application_stores and their resources.
The object owns every store it built and, for PostgreSQL, the shared
connection pool. close() closes the stores and then the pool, each at
most once; after a failed close, calling it again retries only what did not
close. Cayu’s server does not close application stores; long-lived processes
keep them for their lifetime, and tests or scripts close them explicitly.
init (method)
Section titled “init (method)”ApplicationStores.__init__(*, backend: SessionStoreBackend, session_store: SessionStore, task_store: TaskStore | None, knowledge_store: KnowledgeStore | None, product_store: ProductOperationStore | None=None, model_policy_store: ModelPolicyStore | None=None, pool: Any | None=None, pool_max_size: int | None=None, task_admission_listener: bool=False) -> Nonebackend (property)
Section titled “backend (property)”ApplicationStores.backend() -> SessionStoreBackendsession_store (property)
Section titled “session_store (property)”ApplicationStores.session_store() -> SessionStoretask_store (property)
Section titled “task_store (property)”ApplicationStores.task_store() -> TaskStore | Noneknowledge_store (property)
Section titled “knowledge_store (property)”ApplicationStores.knowledge_store() -> KnowledgeStore | Noneproduct_store (property)
Section titled “product_store (property)”ApplicationStores.product_store() -> ProductOperationStore | NoneThe maintained service’s product operation store, when requested.
model_policy_store (property)
Section titled “model_policy_store (property)”ApplicationStores.model_policy_store() -> ModelPolicyStore | Nonepool_max_size (property)
Section titled “pool_max_size (property)”ApplicationStores.pool_max_size() -> int | NoneMaximum pooled PostgreSQL connections shared by the stores, if any.
connection_budget (property)
Section titled “connection_budget (property)”ApplicationStores.connection_budget() -> intMost PostgreSQL connections these stores open (pool plus listener).
close (method)
Section titled “close (method)”async ApplicationStores.close() -> NoneClose the stores, then the shared pool.
Once everything closed, later calls do nothing. After a failure, a later call retries only the parts that did not close.
aenter (method)
Section titled “aenter (method)”async ApplicationStores.__aenter__() -> ApplicationStoresaexit (method)
Section titled “aexit (method)”async ApplicationStores.__aexit__(*exc_info: object) -> NoneRelease source · Runtime guarantees · Capability guides
open_application_stores
Section titled “open_application_stores”from cayu import open_application_storesBuild the application’s session, task, and knowledge stores.
database_url is normally configured_database_url(), the value of
CAYU_DATABASE_URL. A postgres:// or postgresql:// URL builds the
PostgreSQL stores on one shared connection pool of at most pool_max_size
connections (default CAYU_DATABASE_POOL_MAX, else 5). They validate the
schema at first use; migrations are an explicit deploy step
(cayu storage migrate). The task store keeps one dedicated LISTEN
connection outside the pool for task-admission wakeups. It connects to
direct_database_url (default CAYU_DATABASE_DIRECT_URL, else
database_url), because LISTEN does not survive transaction pooling.
None builds SQLite stores in sqlite_path, which must be absolute, with
SQLite’s local-development schema behavior. An absolute sqlite:/// URL
selects that file instead, matching the CLI’s store resolution. Any other URL
scheme raises SessionStoreTargetError.
tasks and knowledge_scope choose which optional stores exist.
product_operations=True adds the maintained service’s product operation
store (it requires the server extra); on PostgreSQL it shares the pool, so the
connection budget is unchanged. Nothing connects during construction.
open_application_stores(database_url: str | None, *, sqlite_path: str | os.PathLike[str], tasks: bool=True, knowledge_scope: KnowledgeAccessScope | None=None, product_operations: bool=False, model_policy: bool=False, public_authority_alias_codec: PublicAuthorityAliasCodec | None=None, pool_max_size: int | None=None, direct_database_url: str | None=None) -> ApplicationStores