diff options
author | Alex Auvolat <alex@adnab.me> | 2023-11-14 14:28:16 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-11-14 14:28:16 +0100 |
commit | 3b361d2959e3d577bdae6f8a5ccb0c9d5526b7ea (patch) | |
tree | f5448d44c7d5705c1e31912ca6d101c5998523ef /src/table/replication/sharded.rs | |
parent | 866196750fca74c1911ade2a90611f3663e60046 (diff) | |
download | garage-3b361d2959e3d577bdae6f8a5ccb0c9d5526b7ea.tar.gz garage-3b361d2959e3d577bdae6f8a5ccb0c9d5526b7ea.zip |
layout: prepare for write sets
Diffstat (limited to 'src/table/replication/sharded.rs')
-rw-r--r-- | src/table/replication/sharded.rs | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/table/replication/sharded.rs b/src/table/replication/sharded.rs index f02b1d66..1320a189 100644 --- a/src/table/replication/sharded.rs +++ b/src/table/replication/sharded.rs @@ -25,21 +25,19 @@ pub struct TableShardedReplication { } impl TableReplication for TableShardedReplication { + fn storage_nodes(&self, hash: &Hash) -> Vec<Uuid> { + self.system.cluster_layout().storage_nodes_of(hash) + } + fn read_nodes(&self, hash: &Hash) -> Vec<Uuid> { - self.system - .cluster_layout() - .current() - .nodes_of(hash, self.replication_factor) + self.system.cluster_layout().read_nodes_of(hash) } fn read_quorum(&self) -> usize { self.read_quorum } - fn write_nodes(&self, hash: &Hash) -> Vec<Uuid> { - self.system - .cluster_layout() - .current() - .nodes_of(hash, self.replication_factor) + fn write_sets(&self, hash: &Hash) -> Vec<Vec<Uuid>> { + self.system.cluster_layout().write_sets_of(hash) } fn write_quorum(&self) -> usize { self.write_quorum @@ -60,13 +58,7 @@ impl TableReplication for TableShardedReplication { .current() .partitions() .map(|(partition, first_hash)| { - let mut storage_nodes = layout - .write_sets_of(&first_hash) - .map(|x| x.into_iter()) - .flatten() - .collect::<Vec<_>>(); - storage_nodes.sort(); - storage_nodes.dedup(); + let storage_nodes = layout.storage_nodes_of(&first_hash); SyncPartition { partition, first_hash, |