Lifecycle
WorkaDB exposes a host-driven lifecycle. The host is responsible for initialization, issuing requests, and shutting down the engine.
Initialization
- The host calls
wepg_initwith awepg_configthat includes thepgdata_pathandtmp_path. - If the data directory does not exist,
wepg_initperforms a template-based initdb unlessWEPG_FLAG_NO_AUTO_INITDBis set. - The host may call
wepg_initdbexplicitly to force initialization.
Execution
The host executes SQL by calling wepg_step with a SQL request. Each step is processed synchronously and returns a response buffer.
Reset and shutdown
wepg_resetclears session state without destroying the data directory.wepg_shutdownreleases resources and closes the engine. The host must not use the handle after shutdown.
This explicit lifecycle makes WorkaDB safe for mobile foreground and background transitions.