bootstrap 3P stores in tauri after import

pull/19/head
Niko PLP 7 months ago
parent 9e01c2884a
commit ea4b203b16
  1. 2
      nextgraph/src/local_broker.rs
  2. 6
      ng-verifier/src/verifier.rs

@ -1306,7 +1306,7 @@ pub async fn user_connect_with_device_info(
session.verifier.connected_server_id = Some(server_key); session.verifier.connected_server_id = Some(server_key);
// successful. we can stop here // successful. we can stop here
// load verifier from remote connection (if not RocksDb type) // load verifier from remote connection (if not RocksDb type, or after import on tauri)
if let Err(e) = session.verifier.bootstrap().await { if let Err(e) = session.verifier.bootstrap().await {
session.verifier.connected_server_id = None; session.verifier.connected_server_id = None;
Broker::close_all_connections().await; Broker::close_all_connections().await;

@ -176,6 +176,10 @@ impl Verifier {
self.config.config_type.is_in_memory() self.config.config_type.is_in_memory()
} }
fn need_bootstrap(&self) -> bool {
self.stores.len() == 0
}
fn get_arc_block_storage( fn get_arc_block_storage(
&self, &self,
) -> Result<Arc<std::sync::RwLock<dyn BlockStorage + Send + Sync>>, VerifierError> { ) -> Result<Arc<std::sync::RwLock<dyn BlockStorage + Send + Sync>>, VerifierError> {
@ -942,7 +946,7 @@ impl Verifier {
} }
async fn bootstrap_from_remote(&mut self) -> Result<(), NgError> { async fn bootstrap_from_remote(&mut self) -> Result<(), NgError> {
if self.is_in_memory() { if self.is_in_memory() || self.need_bootstrap() {
let broker = BROKER.read().await; let broker = BROKER.read().await;
let user = self.config.user_priv_key.to_pub(); let user = self.config.user_priv_key.to_pub();
let remote = self.connected_server_id.to_owned().unwrap(); let remote = self.connected_server_id.to_owned().unwrap();

Loading…
Cancel
Save