mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-10 14:36:51 +00:00
[sqlite-r2d2] implement connection pooling in sqlite backend
This commit is contained in:
+2
-8
@@ -91,14 +91,8 @@ pub fn open_db(path: &PathBuf, engine: Engine, opt: &OpenOpt) -> Result<Db> {
|
||||
#[cfg(feature = "sqlite")]
|
||||
Engine::Sqlite => {
|
||||
info!("Opening Sqlite database at: {}", path.display());
|
||||
let db = crate::sqlite_adapter::rusqlite::Connection::open(&path)?;
|
||||
db.pragma_update(None, "journal_mode", "WAL")?;
|
||||
if opt.fsync {
|
||||
db.pragma_update(None, "synchronous", "NORMAL")?;
|
||||
} else {
|
||||
db.pragma_update(None, "synchronous", "OFF")?;
|
||||
}
|
||||
Ok(crate::sqlite_adapter::SqliteDb::init(db))
|
||||
let manager = r2d2_sqlite::SqliteConnectionManager::file(path);
|
||||
Ok(crate::sqlite_adapter::SqliteDb::new(manager, opt.fsync)?)
|
||||
}
|
||||
|
||||
// ---- LMDB DB ----
|
||||
|
||||
Reference in New Issue
Block a user