LCOV - differential code coverage report
Current view: top level - pageserver/ctl/src - index_part.rs (source / functions) Coverage Total Hit UBC CBC
Current: cd44433dd675caa99df17a61b18949c8387e2242.info Lines: 94.1 % 17 16 1 16
Current Date: 2024-01-09 02:06:09 Functions: 41.7 % 12 5 7 5
Baseline: 66c52a629a0f4a503e193045e0df4c77139e344b.info
Baseline Date: 2024-01-08 15:34:46

           TLA  Line data    Source code
       1                 : use std::collections::HashMap;
       2                 : 
       3                 : use anyhow::Context;
       4                 : use camino::Utf8PathBuf;
       5                 : use pageserver::tenant::remote_timeline_client::index::IndexLayerMetadata;
       6                 : use pageserver::tenant::storage_layer::LayerFileName;
       7                 : use pageserver::tenant::{metadata::TimelineMetadata, IndexPart};
       8                 : use utils::lsn::Lsn;
       9                 : 
      10 CBC          12 : #[derive(clap::Subcommand)]
      11                 : pub(crate) enum IndexPartCmd {
      12 UBC           0 :     Dump { path: Utf8PathBuf },
      13                 : }
      14                 : 
      15 CBC           6 : pub(crate) async fn main(cmd: &IndexPartCmd) -> anyhow::Result<()> {
      16               6 :     match cmd {
      17               6 :         IndexPartCmd::Dump { path } => {
      18               6 :             let bytes = tokio::fs::read(path).await.context("read file")?;
      19               6 :             let des: IndexPart = IndexPart::from_s3_bytes(&bytes).context("deserialize")?;
      20               6 :             #[derive(serde::Serialize)]
      21                 :             struct Output<'a> {
      22                 :                 layer_metadata: &'a HashMap<LayerFileName, IndexLayerMetadata>,
      23                 :                 disk_consistent_lsn: Lsn,
      24                 :                 timeline_metadata: &'a TimelineMetadata,
      25                 :             }
      26                 : 
      27               6 :             let output = Output {
      28               6 :                 layer_metadata: &des.layer_metadata,
      29               6 :                 disk_consistent_lsn: des.get_disk_consistent_lsn(),
      30               6 :                 timeline_metadata: &des.metadata,
      31               6 :             };
      32                 : 
      33               6 :             let output = serde_json::to_string_pretty(&output).context("serialize output")?;
      34               6 :             println!("{output}");
      35               6 :             Ok(())
      36                 :         }
      37                 :     }
      38               6 : }
        

Generated by: LCOV version 2.1-beta