LCOV - code coverage report
Current view: top level - control_plane/attachment_service/src - lib.rs (source / functions) Coverage Total Hit
Test: 32f4a56327bc9da697706839ed4836b2a00a408f.info Lines: 100.0 % 21 21
Test Date: 2024-02-07 07:37:29 Functions: 56.0 % 25 14

            Line data    Source code
       1              : use serde::{Deserialize, Serialize};
       2              : use utils::seqwait::MonotonicCounter;
       3              : 
       4              : mod compute_hook;
       5              : pub mod http;
       6              : mod node;
       7              : pub mod persistence;
       8              : mod reconciler;
       9              : mod scheduler;
      10              : mod schema;
      11              : pub mod service;
      12              : mod tenant_state;
      13              : 
      14          504 : #[derive(Clone, Serialize, Deserialize)]
      15              : enum PlacementPolicy {
      16              :     /// Cheapest way to attach a tenant: just one pageserver, no secondary
      17              :     Single,
      18              :     /// Production-ready way to attach a tenant: one attached pageserver and
      19              :     /// some number of secondaries.
      20              :     Double(usize),
      21              :     /// Do not attach to any pageservers
      22              :     Detached,
      23              : }
      24              : 
      25         2410 : #[derive(Ord, PartialOrd, Eq, PartialEq, Copy, Clone)]
      26              : struct Sequence(u64);
      27              : 
      28              : impl Sequence {
      29           27 :     fn initial() -> Self {
      30           27 :         Self(0)
      31           27 :     }
      32              : }
      33              : 
      34              : impl std::fmt::Display for Sequence {
      35          984 :     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      36          984 :         write!(f, "{}", self.0)
      37          984 :     }
      38              : }
      39              : 
      40              : impl MonotonicCounter<Sequence> for Sequence {
      41          489 :     fn cnt_advance(&mut self, v: Sequence) {
      42          489 :         assert!(*self <= v);
      43          489 :         *self = v;
      44          489 :     }
      45         1452 :     fn cnt_value(&self) -> Sequence {
      46         1452 :         *self
      47         1452 :     }
      48              : }
      49              : 
      50              : impl Sequence {
      51            5 :     fn next(&self) -> Sequence {
      52            5 :         Sequence(self.0 + 1)
      53            5 :     }
      54              : }
      55              : 
      56              : impl Default for PlacementPolicy {
      57           13 :     fn default() -> Self {
      58           13 :         PlacementPolicy::Double(1)
      59           13 :     }
      60              : }
        

Generated by: LCOV version 2.1-beta