MCPcopy Create free account
hub / github.com/emwalker/digraph / main

Function main

backend/src/bin/export.rs:566–588  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

564
565#[tokio::main]
566async fn main() -> Result<()> {
567 let config = Config::load()?;
568 env_logger::init();
569 let pool = db::db_connection(&config).await?;
570 let opts = parse_args();
571
572 if !opts.root.exists() {
573 return Err(Error::NotFound(format!("{:?}", opts.root)));
574 }
575 let root = DataRoot::new(opts.root);
576 let actor = Arc::new(Viewer::service_account());
577 let client = Client::new(actor, &root, Timespec);
578 let mut mutation = client.mutation(IndexMode::Replace)?;
579
580 export_topics(&mut mutation, &pool).await.unwrap();
581 export_links(&mut mutation, &pool).await.unwrap();
582
583 log::info!("saving trees and indexes");
584 mutation.write(&redis::Noop)?;
585
586 log::info!("exported database to {}", root);
587 Ok(())
588}

Callers

nothing calls this directly

Calls 8

initFunction · 0.85
db_connectionFunction · 0.85
export_topicsFunction · 0.85
export_linksFunction · 0.85
existsMethod · 0.80
parse_argsFunction · 0.70
mutationMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected