TimelessMetrics.DB (timeless_metrics v6.0.6)

Copy Markdown View Source

SQLite connection manager with a single writer and pooled readers.

Uses WAL mode for concurrent reads during writes. The writer is serialized through a GenServer to respect SQLite's single-writer constraint.

Summary

Functions

Create a consistent backup of this database using VACUUM INTO.

Returns a specification to start this module under a supervisor.

Get the database path.

Execute a read query using a reader connection from the pool.

Execute a write query (INSERT, UPDATE, DELETE) through the serialized writer.

Execute multiple write queries in a single transaction.

Functions

backup(db, target_path)

Create a consistent backup of this database using VACUUM INTO.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

db_path(db)

Get the database path.

read(db, sql, params \\ [])

Execute a read query using a reader connection from the pool.

start_link(opts)

write(db, sql, params \\ [])

Execute a write query (INSERT, UPDATE, DELETE) through the serialized writer.

write_transaction(db, fun)

Execute multiple write queries in a single transaction.