relocalize logic for write_sets

This commit is contained in:
Alex Auvolat
2025-03-25 16:35:56 +01:00
parent 514eb29874
commit d25e631a4a
3 changed files with 20 additions and 19 deletions
+10 -4
View File
@@ -51,9 +51,7 @@ impl TableReplication for TableFullReplication {
}
fn write_sets(&self, _hash: &Hash) -> Self::WriteSets {
self.system
.layout_manager
.write_lock_with(|l| l.write_sets_of(None))
self.system.layout_manager.write_lock_with(write_sets)
}
fn write_quorum(&self) -> usize {
let layout = self.system.cluster_layout();
@@ -89,7 +87,7 @@ impl TableReplication for TableFullReplication {
partition: 0u16,
first_hash: [0u8; 32].into(),
last_hash: [0xff; 32].into(),
storage_sets: layout.write_sets_of(None),
storage_sets: write_sets(&layout),
}];
SyncPartitions {
@@ -98,3 +96,11 @@ impl TableReplication for TableFullReplication {
}
}
}
fn write_sets(layout: &LayoutHelper) -> Vec<Vec<Uuid>> {
layout
.versions()
.iter()
.map(|x| x.all_nodes().to_vec())
.collect()
}
+10 -2
View File
@@ -56,7 +56,7 @@ impl TableReplication for TableShardedReplication {
fn write_sets(&self, hash: &Hash) -> Self::WriteSets {
self.system
.layout_manager
.write_lock_with(|l| l.write_sets_of(Some(hash)))
.write_lock_with(|l| write_sets(l, hash))
}
fn write_quorum(&self) -> usize {
self.write_quorum
@@ -78,7 +78,7 @@ impl TableReplication for TableShardedReplication {
partition,
first_hash,
last_hash: [0u8; 32].into(), // filled in just after
storage_sets: layout.write_sets_of(Some(&first_hash)),
storage_sets: write_sets(&layout, &first_hash),
}
})
.collect::<Vec<_>>();
@@ -97,3 +97,11 @@ impl TableReplication for TableShardedReplication {
}
}
}
fn write_sets(layout: &LayoutHelper, hash: &Hash) -> Vec<Vec<Uuid>> {
layout
.versions()
.iter()
.map(|x| x.nodes_of(hash).collect())
.collect()
}