LCOV - code coverage report
Current view: top level - storage_controller/src - background_node_operations.rs (source / functions) Coverage Total Hit
Test: 1e20c4f2b28aa592527961bb32170ebbd2c9172f.info Lines: 0.0 % 15 0
Test Date: 2025-07-16 12:29:03 Functions: 0.0 % 4 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 Delete {
      11              :     pub(crate) node_id: NodeId,
      12              : }
      13              : 
      14              : #[derive(Copy, Clone)]
      15              : pub(crate) struct Drain {
      16              :     pub(crate) node_id: NodeId,
      17              : }
      18              : 
      19              : #[derive(Copy, Clone)]
      20              : pub(crate) struct Fill {
      21              :     pub(crate) node_id: NodeId,
      22              : }
      23              : 
      24              : #[derive(Copy, Clone)]
      25              : pub(crate) enum Operation {
      26              :     Delete(Delete),
      27              :     Drain(Drain),
      28              :     Fill(Fill),
      29              : }
      30              : 
      31              : #[derive(Debug, thiserror::Error)]
      32              : pub(crate) enum OperationError {
      33              :     #[error("Node state changed during operation: {0}")]
      34              :     NodeStateChanged(Cow<'static, str>),
      35              :     #[error("Operation finalize error: {0}")]
      36              :     FinalizeError(Cow<'static, str>),
      37              :     #[error("Operation cancelled")]
      38              :     Cancelled,
      39              :     #[error("Impossible constraint error: {0}")]
      40              :     ImpossibleConstraint(Cow<'static, str>),
      41              : }
      42              : 
      43              : pub(crate) struct OperationHandler {
      44              :     pub(crate) operation: Operation,
      45              :     #[allow(unused)]
      46              :     pub(crate) cancel: CancellationToken,
      47              : }
      48              : 
      49              : impl Display for Delete {
      50            0 :     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      51            0 :         write!(f, "delete {}", self.node_id)
      52            0 :     }
      53              : }
      54              : 
      55              : impl Display for Drain {
      56            0 :     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      57            0 :         write!(f, "drain {}", self.node_id)
      58            0 :     }
      59              : }
      60              : 
      61              : impl Display for Fill {
      62            0 :     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      63            0 :         write!(f, "fill {}", self.node_id)
      64            0 :     }
      65              : }
      66              : 
      67              : impl Display for Operation {
      68            0 :     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
      69            0 :         match self {
      70            0 :             Operation::Delete(op) => write!(f, "{op}"),
      71            0 :             Operation::Drain(op) => write!(f, "{op}"),
      72            0 :             Operation::Fill(op) => write!(f, "{op}"),
      73              :         }
      74            0 :     }
      75              : }
        

Generated by: LCOV version 2.1-beta