pull/201/head
phiresky 4 months ago
parent 3ccf371fa6
commit 5397636910

877
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -42,7 +42,7 @@ paste = "1.0.12"
path-clean = "1.0.1"
pretty-bytes = "0.2.2"
regex = "1.8.2"
rusqlite = {version = "0.29.0", features = ["vtab", "bundled"]}
rusqlite = {version = "0.30.0", features = ["vtab", "bundled"]}
schemars = {version = "0.8.12", features = ["preserve_order"]}
serde = {version = "1.0.163", features = ["derive"]}
serde_json = "1.0.96"
@ -50,7 +50,7 @@ size_format = "1.0.2"
structopt = "0.3.26"
tempfile = "3.5.0"
tokio = {version = "1.28.1", features = ["full"]}
tokio-rusqlite = "0.4.0"
tokio-rusqlite = "0.5.0"
tokio-stream = {version = "0.1.14", features = ["io-util", "tokio-util"]}
tokio-tar = { git = "https://github.com/vorot93/tokio-tar", version = "0.3.0" }
tokio-util = {version = "0.7.8", features = ["io", "full"]}

@ -174,7 +174,7 @@ pub fn get_adapters_filtered<T: AsRef<str>>(
let inx = adapters
.iter()
.position(|a| a.metadata().name == name)
.ok_or_else(|| format_err!("Could not remove {}: Not in list", name))?;
.ok_or_else(|| format_err!("Could not remove adapter {}: Not in list", name))?;
adapters.remove(inx);
} else {
let adapter = adapters_map

@ -75,11 +75,11 @@ async fn connect_pragmas(db: &Connection) -> Result<()> {
create unique index if not exists preproc_cache_idx on preproc_cache (adapter, adapter_version, file_path, active_adapters);
",
)
)?; Ok(())
})
.await.context("connect_pragmas")?;
let jm: i64 = db
.call(|db| db.pragma_query_value(None, "application_id", |r| r.get(0)))
.call(|db| Ok(db.pragma_query_value(None, "application_id", |r| r.get(0))?))
.await?;
if jm != 924716026 {
// (probably) newly created db
@ -95,7 +95,8 @@ async fn create_pragmas(db: &Connection) -> Result<()> {
pragma application_id = 924716026;
pragma user_version = 2; -- todo: on upgrade clear db if version is unexpected
",
)
)?;
Ok(())
})
.await?;
Ok(())
@ -119,24 +120,25 @@ impl PreprocCache for SqliteCache {
Ok(self
.db
.call(move |db| {
db.query_row(
"select text_content_zstd from preproc_cache where
Ok(db
.query_row(
"select text_content_zstd from preproc_cache where
adapter = :adapter
and adapter_version = :adapter_version
and active_adapters = :active_adapters
and file_path = :file_path
and file_mtime_unix_ms = :file_mtime_unix_ms
",
named_params! {
":adapter": &key.adapter,
":adapter_version": &key.adapter_version,
":active_adapters": &key.active_adapters,
":file_path": &key.file_path,
":file_mtime_unix_ms": &key.file_mtime_unix_ms
},
|r| r.get::<_, Vec<u8>>(0),
)
.optional()
named_params! {
":adapter": &key.adapter,
":adapter_version": &key.adapter_version,
":active_adapters": &key.active_adapters,
":file_path": &key.file_path,
":file_mtime_unix_ms": &key.file_mtime_unix_ms
},
|r| r.get::<_, Vec<u8>>(0),
)
.optional()?)
})
.await
.context("reading from cache")?)
@ -161,8 +163,8 @@ impl PreprocCache for SqliteCache {
":file_path": &key.file_path,
":file_mtime_unix_ms": &key.file_mtime_unix_ms,
":text_content_zstd": value
}
).map(|_| ())
})?;
Ok(())
})
.await?)
}

Loading…
Cancel
Save