Push starting snapshot hashes in SnapshotGossipManager::new() (#31173)
This commit is contained in:
parent
fdecd0dcaa
commit
e05957d8fa
|
@ -57,11 +57,9 @@ impl SnapshotPackagerService {
|
||||||
SnapshotGossipManager::new(
|
SnapshotGossipManager::new(
|
||||||
cluster_info,
|
cluster_info,
|
||||||
max_full_snapshot_hashes,
|
max_full_snapshot_hashes,
|
||||||
|
starting_snapshot_hashes,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if let Some(snapshot_gossip_manager) = snapshot_gossip_manager.as_mut() {
|
|
||||||
snapshot_gossip_manager.push_starting_snapshot_hashes(starting_snapshot_hashes);
|
|
||||||
}
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if exit.load(Ordering::Relaxed) {
|
if exit.load(Ordering::Relaxed) {
|
||||||
|
|
|
@ -19,28 +19,30 @@ pub struct SnapshotGossipManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SnapshotGossipManager {
|
impl SnapshotGossipManager {
|
||||||
/// Construct a new SnapshotGossipManager with empty snapshot hashes
|
/// Construct a new SnapshotGossipManager and push any
|
||||||
|
/// starting snapshot hashes to the cluster via CRDS
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn new(cluster_info: Arc<ClusterInfo>, max_full_snapshot_hashes: usize) -> Self {
|
pub fn new(
|
||||||
SnapshotGossipManager {
|
cluster_info: Arc<ClusterInfo>,
|
||||||
|
max_full_snapshot_hashes: usize,
|
||||||
|
starting_snapshot_hashes: Option<StartingSnapshotHashes>,
|
||||||
|
) -> Self {
|
||||||
|
let mut this = SnapshotGossipManager {
|
||||||
cluster_info,
|
cluster_info,
|
||||||
latest_snapshot_hashes: None,
|
latest_snapshot_hashes: None,
|
||||||
max_full_snapshot_hashes,
|
max_full_snapshot_hashes,
|
||||||
legacy_full_snapshot_hashes: FullSnapshotHashes {
|
legacy_full_snapshot_hashes: FullSnapshotHashes {
|
||||||
hashes: Vec::default(),
|
hashes: Vec::default(),
|
||||||
},
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Push any starting snapshot hashes to the cluster via CRDS
|
|
||||||
pub fn push_starting_snapshot_hashes(
|
|
||||||
&mut self,
|
|
||||||
starting_snapshot_hashes: Option<StartingSnapshotHashes>,
|
|
||||||
) {
|
|
||||||
let Some(starting_snapshot_hashes) = starting_snapshot_hashes else {
|
|
||||||
return;
|
|
||||||
};
|
};
|
||||||
|
if let Some(starting_snapshot_hashes) = starting_snapshot_hashes {
|
||||||
|
this.push_starting_snapshot_hashes(starting_snapshot_hashes);
|
||||||
|
}
|
||||||
|
this
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Push starting snapshot hashes to the cluster via CRDS
|
||||||
|
fn push_starting_snapshot_hashes(&mut self, starting_snapshot_hashes: StartingSnapshotHashes) {
|
||||||
self.update_latest_full_snapshot_hash(starting_snapshot_hashes.full.hash);
|
self.update_latest_full_snapshot_hash(starting_snapshot_hashes.full.hash);
|
||||||
if let Some(starting_incremental_snapshot_hash) = starting_snapshot_hashes.incremental {
|
if let Some(starting_incremental_snapshot_hash) = starting_snapshot_hashes.incremental {
|
||||||
self.update_latest_incremental_snapshot_hash(
|
self.update_latest_incremental_snapshot_hash(
|
||||||
|
|
Loading…
Reference in New Issue