Add --tenant-id and --timeline-id options

This commit is contained in:
Heikki Linnakangas
2024-09-12 13:28:12 +03:00
parent abed35589b
commit fe975acc71
3 changed files with 22 additions and 11 deletions

View File

@@ -2,8 +2,11 @@ use anyhow;
use camino::Utf8PathBuf;
use clap::Parser;
use pageserver::{pg_import, virtual_file::{self, api::IoEngineKind}};
use utils::id::{TenantId, TimelineId};
use utils::logging::{self, LogFormat, TracingErrorLayerEnablement};
use std::str::FromStr;
//project_git_version!(GIT_VERSION);
#[derive(Parser)]
@@ -18,6 +21,11 @@ struct CliOpts {
/// Path to local dir where the layer files will be stored
dest_path: Utf8PathBuf,
#[arg(long, default_value_t = TenantId::from_str("42424242424242424242424242424242").unwrap())]
tenant_id: TenantId,
#[arg(long, default_value_t = TimelineId::from_str("42424242424242424242424242424242").unwrap())]
timeline_id: TimelineId,
}
fn main() -> anyhow::Result<()> {
@@ -45,7 +53,9 @@ fn main() -> anyhow::Result<()> {
}
async fn async_main(cli: CliOpts) -> anyhow::Result<()> {
let mut import = pg_import::PgImportEnv::init().await?;
import.import_datadir(&cli.pgdata, &cli.dest_path).await?;
let mut import = pg_import::PgImportEnv::init(&cli.dest_path, cli.tenant_id, cli.timeline_id).await?;
import.import_datadir(&cli.pgdata).await?;
Ok(())
}