LCOV - differential code coverage report
Current view: top level - pageserver/pagebench/src/util/cli - targets.rs (source / functions) Coverage Total Hit UBC
Current: cd44433dd675caa99df17a61b18949c8387e2242.info Lines: 0.0 % 18 0 18
Current Date: 2024-01-09 02:06:09 Functions: 0.0 % 4 0 4
Baseline: 66c52a629a0f4a503e193045e0df4c77139e344b.info
Baseline Date: 2024-01-08 15:34:46

           TLA  Line data    Source code
       1                 : use std::sync::Arc;
       2                 : 
       3                 : use pageserver_client::mgmt_api;
       4                 : use tracing::info;
       5                 : use utils::id::TenantTimelineId;
       6                 : 
       7                 : pub(crate) struct Spec {
       8                 :     pub(crate) limit_to_first_n_targets: Option<usize>,
       9                 :     pub(crate) targets: Option<Vec<TenantTimelineId>>,
      10                 : }
      11                 : 
      12 UBC           0 : pub(crate) async fn discover(
      13               0 :     api_client: &Arc<mgmt_api::Client>,
      14               0 :     spec: Spec,
      15               0 : ) -> anyhow::Result<Vec<TenantTimelineId>> {
      16               0 :     let mut timelines = if let Some(targets) = spec.targets {
      17               0 :         targets
      18                 :     } else {
      19               0 :         mgmt_api::util::get_pageserver_tenant_timelines_unsharded(api_client).await?
      20                 :     };
      21                 : 
      22               0 :     if let Some(limit) = spec.limit_to_first_n_targets {
      23               0 :         timelines.sort(); // for determinism
      24               0 :         timelines.truncate(limit);
      25               0 :         if timelines.len() < limit {
      26               0 :             anyhow::bail!("pageserver has less than limit_to_first_n_targets={limit} tenants");
      27               0 :         }
      28               0 :     }
      29                 : 
      30               0 :     info!("timelines:\n{:?}", timelines);
      31               0 :     info!("number of timelines:\n{:?}", timelines.len());
      32                 : 
      33               0 :     Ok(timelines)
      34               0 : }
        

Generated by: LCOV version 2.1-beta