1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// SPDX-License-Identifier: BUSL-1.1
//! Wire envelope and result types for cross-cluster snapshot transfer.
use PathBuf;
use Arc;
use ;
use ;
/// Progress callback invoked by [`super::MirrorBootstrapReceiver`] every
/// `PROGRESS_REPORT_CHUNK_BYTES` to update `MirrorStatus::Bootstrapping`.
pub type ProgressCallback = ;
/// Granularity at which the receiver reports progress: ~1 MiB.
pub const PROGRESS_REPORT_CHUNK_BYTES: u64 = 1024 * 1024;
/// Wire envelope that wraps a cross-cluster snapshot chunk.
///
/// Encoded with zerompk (MessagePack) and placed in the `data` field of the
/// existing [`nodedb_raft::InstallSnapshotRequest`]. The in-cluster Raft
/// machinery transfers the bytes unchanged; the mirror receiver unwraps this
/// envelope.
///
/// # Integrity
///
/// `total_crc32c` is the CRC32C of the *entire* snapshot payload (concatenation
/// of every chunk's `data` in offset order). The source computes it once over
/// the snapshot file and stamps the same value into every envelope of the
/// transfer. The receiver maintains a running CRC32C as chunks arrive and
/// validates it against `total_crc32c` when `done = true`; mismatch raises
/// [`super::super::error::MirrorError::SnapshotCrcMismatch`] and the partial
/// file is discarded.
/// Outcome of processing a single incoming snapshot chunk.