sqlite: Rename deadpool_sqlite::Object to SqliteConn consistently

So we know that its always the same type when reading the code.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille
2024-08-23 09:46:18 +02:00
committed by Benjamin Bouvier
parent c769e32b41
commit 154f86aa20
4 changed files with 10 additions and 9 deletions

View File

@@ -188,7 +188,7 @@ impl SqliteCryptoStore {
self.static_account.read().unwrap().clone()
}
async fn acquire(&self) -> Result<deadpool_sqlite::Object> {
async fn acquire(&self) -> Result<SqliteConn> {
Ok(self.pool.get().await?)
}
}
@@ -674,7 +674,7 @@ trait SqliteObjectCryptoStoreExt: SqliteObjectExt {
}
#[async_trait]
impl SqliteObjectCryptoStoreExt for deadpool_sqlite::Object {}
impl SqliteObjectCryptoStoreExt for SqliteConn {}
#[async_trait]
impl CryptoStore for SqliteCryptoStore {

View File

@@ -138,7 +138,7 @@ impl SqliteEventCacheStore {
}
}
async fn acquire(&self) -> Result<deadpool_sqlite::Object> {
async fn acquire(&self) -> Result<SqliteConn> {
Ok(self.pool.get().await?)
}
}
@@ -212,7 +212,7 @@ trait SqliteObjectEventCacheStoreExt: SqliteObjectExt {
}
#[async_trait]
impl SqliteObjectEventCacheStoreExt for deadpool_sqlite::Object {}
impl SqliteObjectEventCacheStoreExt for SqliteConn {}
#[async_trait]
impl EventCacheStore for SqliteEventCacheStore {

View File

@@ -351,7 +351,7 @@ impl SqliteStateStore {
self.encode_key(keys::KV_BLOB, full_key)
}
async fn acquire(&self) -> Result<deadpool_sqlite::Object> {
async fn acquire(&self) -> Result<SqliteConn> {
Ok(self.pool.get().await?)
}
@@ -901,7 +901,7 @@ trait SqliteObjectStateStoreExt: SqliteObjectExt {
}
#[async_trait]
impl SqliteObjectStateStoreExt for deadpool_sqlite::Object {
impl SqliteObjectStateStoreExt for SqliteConn {
async fn set_kv_blob(&self, key: Key, value: Vec<u8>) -> Result<()> {
Ok(self.interact(move |conn| conn.set_kv_blob(&key, &value)).await.unwrap()?)
}

View File

@@ -16,6 +16,7 @@ use core::fmt;
use std::{borrow::Borrow, cmp::min, future::Future, iter, ops::Deref};
use async_trait::async_trait;
use deadpool_sqlite::Object as SqliteConn;
use itertools::Itertools;
use rusqlite::{limits::Limit, OptionalExtension, Params, Row, Statement, Transaction};
@@ -106,7 +107,7 @@ pub(crate) trait SqliteObjectExt {
}
#[async_trait]
impl SqliteObjectExt for deadpool_sqlite::Object {
impl SqliteObjectExt for SqliteConn {
async fn execute<P>(
&self,
sql: impl AsRef<str> + Send + 'static,
@@ -245,7 +246,7 @@ pub(crate) trait SqliteObjectStoreExt: SqliteObjectExt {
}
#[async_trait]
impl SqliteObjectStoreExt for deadpool_sqlite::Object {
impl SqliteObjectStoreExt for SqliteConn {
async fn set_kv(&self, key: &str, value: Vec<u8>) -> rusqlite::Result<()> {
let key = key.to_owned();
self.interact(move |conn| conn.set_kv(&key, &value)).await.unwrap()?;
@@ -255,7 +256,7 @@ impl SqliteObjectStoreExt for deadpool_sqlite::Object {
}
/// Load the version of the database with the given connection.
pub(crate) async fn load_db_version(conn: &deadpool_sqlite::Object) -> Result<u8, OpenStoreError> {
pub(crate) async fn load_db_version(conn: &SqliteConn) -> Result<u8, OpenStoreError> {
let kv_exists = conn
.query_row(
"SELECT count(*) FROM sqlite_master WHERE type = 'table' AND name = 'kv'",