aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index 7ea1afa..66a011f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -26,7 +26,9 @@ struct Args {
#[arg(short, long, default_value = "16")]
par_limit: usize,
#[arg(short, long)]
- db_cache: Option<PathBuf>,
+ redb_cache: Option<PathBuf>,
+ #[arg(short, long)]
+ rocksdb_cache: Option<PathBuf>,
#[clap(subcommand)]
action: Action,
}
@@ -35,7 +37,7 @@ struct Args {
enum Action {
Cache { level: usize },
Export { level: usize },
- CacheFsToDb { db: PathBuf },
+ CacheFsToDb,
}
#[tokio::main]
@@ -44,15 +46,17 @@ async fn main() -> Result<()> {
let args = Args::parse();
- let cache = if let Some(path) = args.db_cache {
- Cache::new_db(&path)?
+ let cache = if let Some(path) = args.rocksdb_cache {
+ Cache::new_rocksdb(&path)?
+ } else if let Some(path) = args.redb_cache {
+ Cache::new_redb(&path)?
} else {
Cache::new_directory()?
};
- let c = GeClient::new(16, cache).await?;
match args.action {
Action::Cache { level } => {
+ let c = GeClient::new(16, cache).await?;
let entry = c.planetoid_metdata().await?;
let epoch = entry.root_node_metadata.unwrap().bulk_metadata_epoch();
cache_all(
@@ -65,6 +69,7 @@ async fn main() -> Result<()> {
.await?;
}
Action::Export { level } => {
+ let c = GeClient::new(16, cache).await?;
let entry = c.planetoid_metdata().await?;
let store = Arc::new(ResourceStore::new_memory());
@@ -85,10 +90,9 @@ async fn main() -> Result<()> {
let file = std::fs::File::create("/tmp/a.respack")?;
save_full_respack(file, &store, Some(entry))?;
}
- Action::CacheFsToDb { db: dbpath } => {
+ Action::CacheFsToDb => {
let source = Cache::new_directory()?;
- let dest = Cache::new_db(&dbpath)?;
- source.transfer_entries(&dest).await?;
+ source.transfer_entries(&cache).await?;
}
}