LCOV - code coverage report
Current view: top level - storage_controller/src - background_node_operations.rs (source / functions) Coverage Total Hit
Test: 2e3a7638747e564a4f6d1af1cc0c3b3438fbb740.info Lines: 0.0 % 12 0
Test Date: 2024-11-20 01:36:58 Functions: 0.0 % 4 0

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

Generated by: LCOV version 2.1-beta