SqlDelightServerStorage

Persistent ServerStorage on SQLite through SQLDelight (docs/server-storage.md).

The host application creates, configures and owns the SqlDriver: it chooses the database location, driver and connection settings, creates the schema with Schema (for example JdbcSqliteDriver(url, properties, Schema), or Schema.create(driver) itself), and closes the driver on shutdown. This class never creates, configures or closes a driver.

Only SQLite-compatible, synchronous drivers are supported: the schema and queries use the SQLite dialect. That the SqlDriver is configurable does not mean arbitrary SQL databases are supported.

Every repository call is one database transaction: if it throws, SQLite rolls back all of its writes. Calls of one instance are serialized by a Mutex and run on dispatcher, because the drivers block and bind a transaction to its thread. Use one instance per database, in one process; uniqueness is additionally enforced by the schema's primary keys.

The database holds public registration keys, public last-device recovery key states and challenges, public prekeys, opaque encrypted envelopes with their routing metadata and nonce replay metadata. It is not encrypted. Timestamps are stored as epoch milliseconds.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val mailboxes: MailboxRepository
Link copied to clipboard
open override val preKeys: PreKeyRepository