initialize

open suspend override fun initialize()

Initializes the SQLite database connection and creates required schema.

This method establishes the database connection, loads the SQLite JDBC driver, and ensures all required tables and indexes exist. The operation is performed asynchronously on the IO dispatcher to prevent blocking the calling coroutine.

Initialization Process:

  1. Driver Loading: Loads org.sqlite.JDBC driver class

  2. Connection Establishment: Creates JDBC connection to SQLite database

  3. Schema Creation: Executes DDL statements for tables and indexes

  4. Validation: Confirms successful initialization with logging

Database Schema Created:

  • container_states: User state persistence with versioning

  • interaction_data: User interaction event logging

  • idx_interaction_user_timestamp: Performance optimization index

Error Handling:

Threading Context:

  • Executes on Dispatchers.IO for non-blocking database operations

  • Safe to call from any coroutine context

See also

Schema creation implementation

Dispatchers.IO

Coroutine context for database operations

Throws

If database initialization fails for any reason