pub async fn get_pool(need_journal: &mut bool) -> Result<(SqlitePool, bool)>
Expand description
有可能改變 need_journal 的值。
若為初始化,或資料庫已被 journal 鎖住,則不論如何都使用 journal
12
13
14
15
16
17
18
19
20
pub async fn init_env(mut need_journal: bool) -> Result<(DBEnv, bool)> {
async fn init_historian() -> Result<Historian> {
let h = Historian::new(path::get_home().to_owned()).await?;
Ok(h)
}
let ((pool, init), historian) =
try_join!(crate::db::get_pool(&mut need_journal), init_historian())?;
Ok((DBEnv::new(pool, historian, need_journal), init))
}