summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock14
-rw-r--r--Cargo.toml6
-rw-r--r--src/db.rs7
-rw-r--r--src/files.rs2
4 files changed, 19 insertions, 10 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 164aa79..1e2b0f3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1475,9 +1475,9 @@ dependencies = [
[[package]]
name = "prettyplease"
-version = "0.2.34"
+version = "0.2.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6837b9e10d61f45f987d50808f83d1ee3d206c66acf650c3e4ae2e1f6ddedf55"
+checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a"
dependencies = [
"proc-macro2",
"syn",
@@ -1914,9 +1914,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.103"
+version = "2.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4307e30089d6fd6aff212f2da3a1f9e32f3223b1f010fb09b7c95f90f3ca1e8"
+checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
dependencies = [
"proc-macro2",
"quote",
@@ -2351,14 +2351,14 @@ version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
- "webpki-roots 1.0.0",
+ "webpki-roots 1.0.1",
]
[[package]]
name = "webpki-roots"
-version = "1.0.0"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2853738d1cc4f2da3a225c18ec6c3721abb31961096e9dbf5ab35fa88b19cfdb"
+checksum = "8782dd5a41a24eed3a4f40b606249b3e236ca61adf1f25ea4d45c73de122b502"
dependencies = [
"rustls-pki-types",
]
diff --git a/Cargo.toml b/Cargo.toml
index 5481e8c..44cac70 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,11 @@ flac-bound = { version = "0.5.0", features = [
], default-features = false }
futures-util = "0.3.31"
i24 = "2.1.0"
-indicatif = { version = "0.17.11", features = ["tokio", "improved_unicode", "futures"] }
+indicatif = { version = "0.17.11", features = [
+ "tokio",
+ "improved_unicode",
+ "futures",
+] }
libsql = { version = "0.9.11" }
md-5 = "0.10.6"
metaflac = "0.2.8"
diff --git a/src/db.rs b/src/db.rs
index 7ca313b..dd32171 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -22,7 +22,7 @@ const DEDUPE_DB: &str =
"DELETE FROM flacs WHERE rowid NOT IN (SELECT MAX(rowid) FROM flacs GROUP BY path)";
#[derive(Debug, Clone)]
-pub struct Database(pub Connection);
+pub struct Database(Connection);
impl Database {
pub async fn new(path: impl AsRef<Path>) -> Result<Self> {
@@ -132,6 +132,11 @@ impl Database {
.unwrap()
.get::<u64>(0)?)
}
+
+ pub async fn vaccum(&self) -> Result<()> {
+ self.0.execute("VACUUM", ()).await?;
+ Ok(())
+ }
}
pub async fn open_default_db() -> Result<Database> {
diff --git a/src/files.rs b/src/files.rs
index 7f346cc..b6c1189 100644
--- a/src/files.rs
+++ b/src/files.rs
@@ -241,7 +241,7 @@ pub async fn clean_files(conn: &Database) -> Result<()> {
#[cfg(not(test))]
spinner.finish();
- conn.0.execute("VACUUM", ()).await?;
+ conn.vaccum().await?;
Ok(())
}