Line data Source code
1 : use anyhow::Context;
2 : use camino::Utf8PathBuf;
3 : use pageserver::tenant::IndexPart;
4 :
5 0 : #[derive(clap::Subcommand)]
6 : pub(crate) enum IndexPartCmd {
7 0 : Dump { path: Utf8PathBuf },
8 : }
9 :
10 0 : pub(crate) async fn main(cmd: &IndexPartCmd) -> anyhow::Result<()> {
11 0 : match cmd {
12 0 : IndexPartCmd::Dump { path } => {
13 0 : let bytes = tokio::fs::read(path).await.context("read file")?;
14 0 : let des: IndexPart = IndexPart::from_json_bytes(&bytes).context("deserialize")?;
15 0 : let output = serde_json::to_string_pretty(&des).context("serialize output")?;
16 0 : println!("{output}");
17 0 : Ok(())
18 : }
19 : }
20 0 : }
|