Add test support and impl dummy /read_markers
This commit is contained in:
parent
93b1d97166
commit
040296c711
5 changed files with 85 additions and 16 deletions
|
@ -1,6 +1,7 @@
|
|||
use crate::utils;
|
||||
use directories::ProjectDirs;
|
||||
use sled::IVec;
|
||||
use std::fs::remove_dir_all;
|
||||
|
||||
pub struct MultiValue(sled::Tree);
|
||||
|
||||
|
@ -65,6 +66,16 @@ pub struct Database {
|
|||
}
|
||||
|
||||
impl Database {
|
||||
/// Tries to remove the old database but ignores all errors.
|
||||
pub fn try_remove(hostname: &str) {
|
||||
let mut path = ProjectDirs::from("xyz", "koesters", "matrixserver")
|
||||
.unwrap()
|
||||
.data_dir()
|
||||
.to_path_buf();
|
||||
path.push(hostname);
|
||||
let _ = remove_dir_all(path);
|
||||
}
|
||||
|
||||
/// Load an existing database or create a new one.
|
||||
pub fn load_or_create(hostname: &str) -> Self {
|
||||
let mut path = ProjectDirs::from("xyz", "koesters", "matrixserver")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue