use std::path::PathBuf;
use anyhow::{Context, Result};
use store::Store;
pub(crate) async fn disable(store: &Store) -> Result<()> {
store.set_meta("sync_enabled", "false").await?;
store.set_meta("contacts_synced", "false").await?;
Ok(())
}
#[cfg(test)]
mod tests;
pub(crate) fn purge(db_path: PathBuf) -> Result<()> {
std::fs::remove_file(&db_path)
.with_context(|| format!("removing database: {}", db_path.display()))?;
let mut wal = db_path.clone().into_os_string();
wal.push("-wal");
let _ = std::fs::remove_file(PathBuf::from(wal));
let mut shm = db_path.into_os_string();
shm.push("-shm");
let _ = std::fs::remove_file(PathBuf::from(shm));
Ok(())
}