LCOV - code coverage report
Current view: top level - control_plane/attachment_service/src - lib.rs (source / functions) Coverage Total Hit
Test: c639aa5f7ab62b43d647b10f40d15a15686ce8a9.info Lines: 100.0 % 21 21
Test Date: 2024-02-12 20:26:03 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          521 : #[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         2457 : #[derive(Ord, PartialOrd, Eq, PartialEq, Copy, Clone)]
      26              : struct Sequence(u64);
      27              : 
      28              : impl Sequence {
      29           30 :     fn initial() -> Self {
      30           30 :         Self(0)
      31           30 :     }
      32              : }
      33              : 
      34              : impl std::fmt::Display for Sequence {
      35         1000 :     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      36         1000 :         write!(f, "{}", self.0)
      37         1000 :     }
      38              : }
      39              : 
      40              : impl MonotonicCounter<Sequence> for Sequence {
      41          499 :     fn cnt_advance(&mut self, v: Sequence) {
      42          499 :         assert!(*self <= v);
      43          499 :         *self = v;
      44          499 :     }
      45         1483 :     fn cnt_value(&self) -> Sequence {
      46         1483 :         *self
      47         1483 :     }
      48              : }
      49              : 
      50              : impl Sequence {
      51            9 :     fn next(&self) -> Sequence {
      52            9 :         Sequence(self.0 + 1)
      53            9 :     }
      54              : }
      55              : 
      56              : impl Default for PlacementPolicy {
      57           14 :     fn default() -> Self {
      58           14 :         PlacementPolicy::Double(1)
      59           14 :     }
      60              : }
        

Generated by: LCOV version 2.1-beta