Skip to main content

qubit_fs/options/
copy_stats.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2026 Haixing Hu.
4 *
5 *    SPDX-License-Identifier: Apache-2.0
6 *
7 *    Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10//! Copy operation statistics.
11
12/// Statistics collected during copy operations.
13#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
14pub struct CopyStats {
15    /// Number of regular files copied.
16    pub files: u64,
17    /// Number of directories created or copied.
18    pub directories: u64,
19    /// Number of symbolic links copied.
20    pub symlinks: u64,
21    /// Number of object-store objects copied.
22    pub objects: u64,
23    /// Number of object-store prefixes or collection resources copied.
24    pub prefixes: u64,
25    /// Number of content bytes copied.
26    pub bytes: u64,
27    /// Number of destination entries overwritten.
28    pub overwritten: u64,
29    /// Number of entries skipped.
30    pub skipped: u64,
31    /// Number of failed entries when continue-on-error is enabled.
32    pub failed: u64,
33}
34
35impl CopyStats {
36    /// Adds another statistics value into this one.
37    ///
38    /// # Parameters
39    /// - `other`: Statistics to add.
40    pub fn add_assign(&mut self, other: &Self) {
41        self.files += other.files;
42        self.directories += other.directories;
43        self.symlinks += other.symlinks;
44        self.objects += other.objects;
45        self.prefixes += other.prefixes;
46        self.bytes += other.bytes;
47        self.overwritten += other.overwritten;
48        self.skipped += other.skipped;
49        self.failed += other.failed;
50    }
51}