feat(file_store)!: have separate methods for creating and opening Store

This commit is contained in:
志宇
2023-10-30 11:02:50 +08:00
parent d294e2e318
commit 24994a3ed4
5 changed files with 64 additions and 38 deletions

View File

@@ -681,7 +681,7 @@ where
index.add_keychain(Keychain::Internal, internal_descriptor);
}
let mut db_backend = match Store::<'m, C>::new_from_path(db_magic, &args.db_path) {
let mut db_backend = match Store::<'m, C>::open_or_create_new(db_magic, &args.db_path) {
Ok(db_backend) => db_backend,
// we cannot return `err` directly as it has lifetime `'m`
Err(err) => return Err(anyhow::anyhow!("failed to init db backend: {:?}", err)),