mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-18 01:17:50 +00:00
avoid using layout_watch in System directly
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user