aboutsummaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-11-08 16:41:00 +0100
committerAlex Auvolat <alex@adnab.me>2023-11-08 16:41:00 +0100
commit4a9c94514f49aa4e9880a8e0f5cf5a52d11ae993 (patch)
tree40a54f544efc25dc7973f0e3766bb396feebbc24 /src/table
parent12d1dbfc6b884be488e2d79c0b9e3c47490f5442 (diff)
downloadgarage-4a9c94514f49aa4e9880a8e0f5cf5a52d11ae993.tar.gz
garage-4a9c94514f49aa4e9880a8e0f5cf5a52d11ae993.zip
avoid using layout_watch in System directly
Diffstat (limited to 'src/table')
-rw-r--r--src/table/replication/fullcopy.rs4
-rw-r--r--src/table/replication/sharded.rs8
-rw-r--r--src/table/sync.rs2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/table/replication/fullcopy.rs b/src/table/replication/fullcopy.rs
index f8b7cacc..34807e3d 100644
--- a/src/table/replication/fullcopy.rs
+++ b/src/table/replication/fullcopy.rs
@@ -27,11 +27,11 @@ impl TableReplication for TableFullReplication {
}
fn write_nodes(&self, _hash: &Hash) -> Vec<Uuid> {
- let layout = self.system.layout_watch.borrow();
+ let layout = self.system.cluster_layout();
layout.node_ids().to_vec()
}
fn write_quorum(&self) -> usize {
- let nmembers = self.system.layout_watch.borrow().node_ids().len();
+ let nmembers = self.system.cluster_layout().node_ids().len();
if nmembers > self.max_faults {
nmembers - self.max_faults
} else {
diff --git a/src/table/replication/sharded.rs b/src/table/replication/sharded.rs
index 95901a5a..60c95cb4 100644
--- a/src/table/replication/sharded.rs
+++ b/src/table/replication/sharded.rs
@@ -26,7 +26,7 @@ pub struct TableShardedReplication {
impl TableReplication for TableShardedReplication {
fn read_nodes(&self, hash: &Hash) -> Vec<Uuid> {
- let layout = self.system.layout_watch.borrow();
+ let layout = self.system.cluster_layout();
layout.nodes_of(hash, self.replication_factor)
}
fn read_quorum(&self) -> usize {
@@ -34,7 +34,7 @@ impl TableReplication for TableShardedReplication {
}
fn write_nodes(&self, hash: &Hash) -> Vec<Uuid> {
- let layout = self.system.layout_watch.borrow();
+ let layout = self.system.cluster_layout();
layout.nodes_of(hash, self.replication_factor)
}
fn write_quorum(&self) -> usize {
@@ -45,9 +45,9 @@ impl TableReplication for TableShardedReplication {
}
fn partition_of(&self, hash: &Hash) -> Partition {
- self.system.layout_watch.borrow().partition_of(hash)
+ self.system.cluster_layout().partition_of(hash)
}
fn partitions(&self) -> Vec<(Partition, Hash)> {
- self.system.layout_watch.borrow().partitions()
+ self.system.cluster_layout().partitions()
}
}
diff --git a/src/table/sync.rs b/src/table/sync.rs
index b2600013..65eff7cd 100644
--- a/src/table/sync.rs
+++ b/src/table/sync.rs
@@ -92,7 +92,7 @@ impl<F: TableSchema, R: TableReplication> TableSyncer<F, R> {
bg.spawn_worker(SyncWorker {
syncer: self.clone(),
layout_watch: self.system.layout_watch.clone(),
- layout: self.system.layout_watch.borrow().clone(),
+ layout: self.system.cluster_layout().clone(),
add_full_sync_rx,
todo: vec![],
next_full_sync: Instant::now() + Duration::from_secs(20),