()
| 564 | |
| 565 | #[tokio::main] |
| 566 | async 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 | } |
nothing calls this directly
no test coverage detected