LCOV - code coverage report
Current view: top level - storage_controller/src - background_node_operations.rs (source / functions) Coverage Total Hit
Test: 6df3fc19ec669bcfbbf9aba41d1338898d24eaa0.info Lines: 0.0 % 11 0
Test Date: 2025-03-12 18:28:53 Functions: 0.0 % 3 0

            Line data    Source code
       1              : use std::borrow::Cow;
       2              : use std::fmt::{Debug, Display};
       3              : 
       4              : use tokio_util::sync::CancellationToken;
       5              : use utils::id::NodeId;
       6              : 
       7              : pub(crate) const MAX_RECONCILES_PER_OPERATION: usize = 64;
       8              : 
       9              : #[derive(Copy, Clone)]
      10              : pub(crate) struct Drain {
      11              :     pub(crate) node_id: NodeId,
      12              : }
      13              : 
      14              : #[derive(Copy, Clone)]
      15              : pub(crate) struct Fill {
      16              :     pub(crate) node_id: NodeId,
      17              : }
      18              : 
      19              : #[derive(Copy, Clone)]
      20              : pub(crate) enum Operation {
      21              :     Drain(Drain),
      22              :     Fill(Fill),
      23              : }
      24              : 
      25              : #[derive(Debug, thiserror::Error)]
      26              : pub(crate) enum OperationError {
      27              :     #[error("Node state changed during operation: {0}")]
      28              :     NodeStateChanged(Cow<'static, str>),
      29              :     #[error("Operation finalize error: {0}")]
      30              :     FinalizeError(Cow<'static, str>),
      31              :     #[error("Operation cancelled")]
      32              :     Cancelled,
      33              : }
      34              : 
      35              : pub(crate) struct OperationHandler {
      36              :     pub(crate) operation: Operation,
      37              :     #[allow(unused)]
      38              :     pub(crate) cancel: CancellationToken,
      39              : }
      40              : 
      41              : impl Display for Drain {
      42            0 :     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      43            0 :         write!(f, "drain {}", self.node_id)
      44            0 :     }
      45              : }
      46              : 
      47              : impl Display for Fill {
      48            0 :     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      49            0 :         write!(f, "fill {}", self.node_id)
      50            0 :     }
      51              : }
      52              : 
      53              : impl Display for Operation {
      54            0 :     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      55            0 :         match self {
      56            0 :             Operation::Drain(op) => write!(f, "{op}"),
      57            0 :             Operation::Fill(op) => write!(f, "{op}"),
      58              :         }
      59            0 :     }
      60              : }
        

Generated by: LCOV version 2.1-beta