#include <chrono>
#include <kj/async.h>
#include <string>
#include <type_traits>
#include "lix/libutil/async.hh"
#include "lix/libutil/result.hh"
#include "lix/libutil/types.hh"
#include "lix/libutil/error.hh"
Go to the source code of this file.
|
|
| nix::MakeError (SQLiteBusy, SQLiteError) |
|
void | nix::handleSQLiteBusy (const SQLiteBusy &e, std::chrono::time_point< std::chrono::steady_clock > &nextWarning) |
|
kj::Promise< Result< void > > | nix::handleSQLiteBusyAsync (const SQLiteBusy &e, std::chrono::time_point< std::chrono::steady_clock > &nextWarning) |
template<typename F>
requires (!requires(F f) { []<typename T>(kj::Promise<T>) {}(f()); }) |
| auto | nix::retrySQLite (F fun, NeverAsync={}) |
template<typename F>
requires requires(F f) { []<typename T>(kj::Promise<Result<T>>) {}(f()); } |
| auto | nix::retrySQLite (F fun) |
◆ SQLiteOpenMode
| Enumerator |
|---|
| Normal | Open the database in read-write mode. If the database does not exist, it will be created.
|
| NoCreate | Open the database in read-write mode. Fails with an error if the database does not exist.
|
| Immutable | Open the database in immutable mode. In addition to the database being read-only, no wal or journal files will be created by sqlite. Use this mode if the database is on a read-only filesystem. Fails with an error if the database does not exist.
|
◆ SQLiteTxnType
| Enumerator |
|---|
| Deferred | A deferred transaction does not actually begin until the database is first accessed. If the first statement in the transaction is a SELECT then a read transaction is started. Subsequent write statements will upgrade the transaction to a write transaction if possible, or return SQLITE_BUSY if another write transaction started on another database connection. If the first statement in the transaction is a write statement then a write transaction is started.
|
| Immediate | An immediate transaction causes the database to start a write transaction immediately, without waiting for a write statement. The transaction might fail wth SQLITE_BUSY if another write transaction is already active on another database connection.
|
| Exclusive | An exclusive transaction causes the database to start a write transaction immediately. In WAL mode this is the same as Immediate, but in other journaling modes this prevents other database connections from reading the database while a transction is underway.
|
◆ retrySQLite()
template<typename F>
requires (!requires(F f) { []<typename T>(kj::Promise<T>) {}(f()); })
Convenience function for retrying a SQLite transaction when the database is busy.