LCOV - code coverage report
Current view: top level - pageserver/src/tenant/timeline/import_pgdata - index_part_format.rs (source / functions) Coverage Total Hit
Test: 20b6afc7b7f34578dcaab2b3acdaecfe91cd8bf1.info Lines: 33.3 % 21 7
Test Date: 2024-11-25 17:48:16 Functions: 15.3 % 72 11

            Line data    Source code
       1              : use serde::{Deserialize, Serialize};
       2              : 
       3              : #[cfg(feature = "testing")]
       4              : use camino::Utf8PathBuf;
       5              : 
       6            4 : #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
       7              : pub enum Root {
       8              :     V1(V1),
       9              : }
      10            4 : #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
      11              : pub enum V1 {
      12              :     InProgress(InProgress),
      13              :     Done(Done),
      14              : }
      15              : 
      16            2 : #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
      17              : #[serde(transparent)]
      18              : pub struct IdempotencyKey(String);
      19              : 
      20              : impl IdempotencyKey {
      21            2 :     pub fn new(s: String) -> Self {
      22            2 :         Self(s)
      23            2 :     }
      24              : }
      25              : 
      26            0 : #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
      27              : pub struct InProgress {
      28              :     pub idempotency_key: IdempotencyKey,
      29              :     pub location: Location,
      30              :     pub started_at: chrono::NaiveDateTime,
      31              : }
      32              : 
      33            8 : #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
      34              : pub struct Done {
      35              :     pub idempotency_key: IdempotencyKey,
      36              :     pub started_at: chrono::NaiveDateTime,
      37              :     pub finished_at: chrono::NaiveDateTime,
      38              : }
      39              : 
      40            0 : #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
      41              : pub enum Location {
      42              :     #[cfg(feature = "testing")]
      43              :     LocalFs { path: Utf8PathBuf },
      44              :     AwsS3 {
      45              :         region: String,
      46              :         bucket: String,
      47              :         key: String,
      48              :     },
      49              : }
      50              : 
      51              : impl Root {
      52            0 :     pub fn is_done(&self) -> bool {
      53            0 :         match self {
      54            0 :             Root::V1(v1) => match v1 {
      55            0 :                 V1::Done(_) => true,
      56            0 :                 V1::InProgress(_) => false,
      57              :             },
      58              :         }
      59            0 :     }
      60            0 :     pub fn idempotency_key(&self) -> &IdempotencyKey {
      61            0 :         match self {
      62            0 :             Root::V1(v1) => match v1 {
      63            0 :                 V1::InProgress(in_progress) => &in_progress.idempotency_key,
      64            0 :                 V1::Done(done) => &done.idempotency_key,
      65              :             },
      66              :         }
      67            0 :     }
      68              : }
        

Generated by: LCOV version 2.1-beta