remove unused database function

i have no idea what this is for

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-02-17 23:20:55 -05:00 committed by June
parent a2f7f6fda4
commit b80be6c709
3 changed files with 1 additions and 66 deletions

50
Cargo.lock generated
View file

@ -392,7 +392,6 @@ dependencies = [
"base64", "base64",
"bytes", "bytes",
"clap", "clap",
"directories",
"figment", "figment",
"futures-util", "futures-util",
"hmac", "hmac",
@ -577,27 +576,6 @@ dependencies = [
"subtle", "subtle",
] ]
[[package]]
name = "directories"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35"
dependencies = [
"dirs-sys",
]
[[package]]
name = "dirs-sys"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"
dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys 0.48.0",
]
[[package]] [[package]]
name = "ed25519" name = "ed25519"
version = "2.2.3" version = "2.2.3"
@ -1269,17 +1247,6 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "libredox"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
dependencies = [
"bitflags 2.4.2",
"libc",
"redox_syscall",
]
[[package]] [[package]]
name = "librocksdb-sys" name = "librocksdb-sys"
version = "0.16.0+8.10.0" version = "0.16.0+8.10.0"
@ -1669,12 +1636,6 @@ dependencies = [
"tokio-stream", "tokio-stream",
] ]
[[package]]
name = "option-ext"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]] [[package]]
name = "ordered-float" name = "ordered-float"
version = "2.10.1" version = "2.10.1"
@ -1987,17 +1948,6 @@ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
] ]
[[package]]
name = "redox_users"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4"
dependencies = [
"getrandom",
"libredox",
"thiserror",
]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.10.3" version = "1.10.3"

View file

@ -37,8 +37,6 @@ tokio = { version = "1.36.0", features = ["fs", "macros", "signal", "sync"] }
# Used for the http request / response body type for Ruma endpoints used with reqwest # Used for the http request / response body type for Ruma endpoints used with reqwest
bytes = "1.5.0" bytes = "1.5.0"
http = "0.2.11" http = "0.2.11"
# Used to find data directory for default db path
directories = "5.0.1"
# Used for ruma wrapper # Used for ruma wrapper
serde_json = { version = "1.0.113", features = ["raw_value"] } serde_json = { version = "1.0.113", features = ["raw_value"] }
# Used for appservice registration files # Used for appservice registration files

View file

@ -7,7 +7,6 @@ use crate::{
}; };
use abstraction::{KeyValueDatabaseEngine, KvTree}; use abstraction::{KeyValueDatabaseEngine, KvTree};
use argon2::{password_hash::SaltString, PasswordHasher, PasswordVerifier}; use argon2::{password_hash::SaltString, PasswordHasher, PasswordVerifier};
use directories::ProjectDirs;
use itertools::Itertools; use itertools::Itertools;
use lru_cache::LruCache; use lru_cache::LruCache;
use rand::thread_rng; use rand::thread_rng;
@ -25,7 +24,7 @@ use ruma::{
use serde::Deserialize; use serde::Deserialize;
use std::{ use std::{
collections::{BTreeMap, HashMap, HashSet}, collections::{BTreeMap, HashMap, HashSet},
fs::{self, remove_dir_all}, fs::{self},
io::Write, io::Write,
mem::size_of, mem::size_of,
path::Path, path::Path,
@ -180,18 +179,6 @@ pub struct KeyValueDatabase {
} }
impl KeyValueDatabase { impl KeyValueDatabase {
/// Tries to remove the old database but ignores all errors.
pub fn try_remove(server_name: &str) -> Result<()> {
let mut path = ProjectDirs::from("xyz", "koesters", "conduit")
.ok_or_else(|| Error::bad_config("The OS didn't return a valid home directory path."))?
.data_dir()
.to_path_buf();
path.push(server_name);
let _ = remove_dir_all(path);
Ok(())
}
fn check_db_setup(config: &Config) -> Result<()> { fn check_db_setup(config: &Config) -> Result<()> {
let path = Path::new(&config.database_path); let path = Path::new(&config.database_path);