LCOV - code coverage report
Current view: top level - storage_controller/src - sk_node.rs (source / functions) Coverage Total Hit
Test: 950df2668cb713840d5f6df1a3b961d557e55aff.info Lines: 0.0 % 26 0
Test Date: 2025-07-30 16:37:54 Functions: 0.0 % 2 0

            Line data    Source code
       1              : use serde::Serialize;
       2              : use std::collections::{HashMap, HashSet};
       3              : use utils::id::{NodeId, TimelineId};
       4              : use uuid::Uuid;
       5              : 
       6              : use crate::hadron_queries::HadronSafekeeperRow;
       7              : 
       8              : // In-memory representation of a Safe Keeper node.
       9              : #[derive(Clone, Serialize)]
      10              : pub(crate) struct SafeKeeperNode {
      11              :     pub(crate) id: NodeId,
      12              :     pub(crate) listen_http_addr: String,
      13              :     pub(crate) listen_http_port: u16,
      14              :     pub(crate) listen_pg_addr: String,
      15              :     pub(crate) listen_pg_port: u16,
      16              : 
      17              :     // All timelines scheduled to this SK node. Some of the timelines may be associated with
      18              :     // a legacy "endpoint", a deprecated concept used in HCC compute CRUD APIs. The "endpoint"
      19              :     // concept will be retired after Public Preview launch.
      20              :     pub(crate) timelines: HashSet<TimelineId>,
      21              :     // All legacy endpoints and their associated timelines scheduled to this SK node.
      22              :     // Invariant: The timelines referenced in this map must be present in the `timelines` set above.
      23              :     pub(crate) legacy_endpoints: HashMap<Uuid, TimelineId>,
      24              : }
      25              : 
      26              : impl SafeKeeperNode {
      27              :     #[allow(unused)]
      28            0 :     pub(crate) fn new(
      29            0 :         id: NodeId,
      30            0 :         listen_http_addr: String,
      31            0 :         listen_http_port: u16,
      32            0 :         listen_pg_addr: String,
      33            0 :         listen_pg_port: u16,
      34            0 :     ) -> Self {
      35            0 :         Self {
      36            0 :             id,
      37            0 :             listen_http_addr,
      38            0 :             listen_http_port,
      39            0 :             listen_pg_addr,
      40            0 :             listen_pg_port,
      41            0 :             legacy_endpoints: HashMap::new(),
      42            0 :             timelines: HashSet::new(),
      43            0 :         }
      44            0 :     }
      45              : 
      46              :     #[allow(unused)]
      47            0 :     pub(crate) fn to_database_row(&self) -> HadronSafekeeperRow {
      48            0 :         HadronSafekeeperRow {
      49            0 :             sk_node_id: self.id.0 as i64,
      50            0 :             listen_http_addr: self.listen_http_addr.clone(),
      51            0 :             listen_http_port: self.listen_http_port as i32,
      52            0 :             listen_pg_addr: self.listen_pg_addr.clone(),
      53            0 :             listen_pg_port: self.listen_pg_port as i32,
      54            0 :         }
      55            0 :     }
      56              : }
        

Generated by: LCOV version 2.1-beta