Remove WAL config from BE

This commit is contained in:
Hanh 2022-12-21 00:33:33 +08:00
parent b0f3cd6a9d
commit d1e59be7ad
3 changed files with 0 additions and 27 deletions

View File

@ -180,8 +180,6 @@ struct CResult_____c_char derive_zip32(uint8_t coin,
bool has_address,
uint32_t address);
void disable_wal(char *db_path);
bool has_cuda(void);
bool has_metal(void);

View File

@ -753,13 +753,6 @@ pub unsafe extern "C" fn derive_zip32(
to_cresult_str(res())
}
#[no_mangle]
pub unsafe extern "C" fn disable_wal(db_path: *mut c_char) {
from_c_str!(db_path);
let res = crate::db::DbAdapter::disable_wal(&db_path);
log_error(res)
}
#[no_mangle]
pub unsafe extern "C" fn has_cuda() -> bool {
crate::gpu::has_cuda()

View File

@ -104,7 +104,6 @@ impl DbAdapter {
pub fn migrate_db(network: &Network, db_path: &str, has_ua: bool) -> anyhow::Result<()> {
let connection = Connection::open(db_path)?;
Self::set_wal(&connection, true)?;
migration::init_db(&connection, network, has_ua)?;
Ok(())
}
@ -142,23 +141,6 @@ impl DbAdapter {
Ok(())
}
pub fn set_wal(connection: &Connection, v: bool) -> anyhow::Result<()> {
if v {
connection.query_row("PRAGMA journal_mode = WAL", [], |_| Ok(()))?;
connection.execute("PRAGMA synchronous = NORMAL", [])?;
}
else {
connection.query_row("PRAGMA journal_mode = OFF", [], |_| Ok(()))?;
}
Ok(())
}
pub fn disable_wal(db_path: &str) -> anyhow::Result<()> {
let connection = Connection::open(db_path)?;
Self::set_wal(&connection, false)?;
Ok(())
}
pub fn begin_transaction(&mut self) -> anyhow::Result<Transaction> {
let tx = self.connection.transaction()?;
Ok(tx)