aboutsummaryrefslogtreecommitdiff
path: root/src/table/replication
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-11-08 15:41:24 +0100
committerAlex Auvolat <alex@adnab.me>2023-11-08 15:41:24 +0100
commit12d1dbfc6b884be488e2d79c0b9e3c47490f5442 (patch)
treeef8c55c60dcbe98b09cbab25bc3cb7b7ede82d4a /src/table/replication
parent0962313ebd45abb116d6ad2ee0eb754f587fc299 (diff)
downloadgarage-12d1dbfc6b884be488e2d79c0b9e3c47490f5442.tar.gz
garage-12d1dbfc6b884be488e2d79c0b9e3c47490f5442.zip
remove Ring and use ClusterLayout everywhere
Diffstat (limited to 'src/table/replication')
-rw-r--r--src/table/replication/fullcopy.rs8
-rw-r--r--src/table/replication/parameters.rs2
-rw-r--r--src/table/replication/sharded.rs14
3 files changed, 12 insertions, 12 deletions
diff --git a/src/table/replication/fullcopy.rs b/src/table/replication/fullcopy.rs
index 18682ace..f8b7cacc 100644
--- a/src/table/replication/fullcopy.rs
+++ b/src/table/replication/fullcopy.rs
@@ -1,6 +1,6 @@
use std::sync::Arc;
-use garage_rpc::ring::*;
+use garage_rpc::layout::*;
use garage_rpc::system::System;
use garage_util::data::*;
@@ -27,11 +27,11 @@ impl TableReplication for TableFullReplication {
}
fn write_nodes(&self, _hash: &Hash) -> Vec<Uuid> {
- let ring = self.system.ring.borrow();
- ring.layout.node_ids().to_vec()
+ let layout = self.system.layout_watch.borrow();
+ layout.node_ids().to_vec()
}
fn write_quorum(&self) -> usize {
- let nmembers = self.system.ring.borrow().layout.node_ids().len();
+ let nmembers = self.system.layout_watch.borrow().node_ids().len();
if nmembers > self.max_faults {
nmembers - self.max_faults
} else {
diff --git a/src/table/replication/parameters.rs b/src/table/replication/parameters.rs
index f00815a2..19b306f2 100644
--- a/src/table/replication/parameters.rs
+++ b/src/table/replication/parameters.rs
@@ -1,4 +1,4 @@
-use garage_rpc::ring::*;
+use garage_rpc::layout::*;
use garage_util::data::*;
/// Trait to describe how a table shall be replicated
diff --git a/src/table/replication/sharded.rs b/src/table/replication/sharded.rs
index 1cf964af..95901a5a 100644
--- a/src/table/replication/sharded.rs
+++ b/src/table/replication/sharded.rs
@@ -1,6 +1,6 @@
use std::sync::Arc;
-use garage_rpc::ring::*;
+use garage_rpc::layout::*;
use garage_rpc::system::System;
use garage_util::data::*;
@@ -26,16 +26,16 @@ pub struct TableShardedReplication {
impl TableReplication for TableShardedReplication {
fn read_nodes(&self, hash: &Hash) -> Vec<Uuid> {
- let ring = self.system.ring.borrow();
- ring.get_nodes(hash, self.replication_factor)
+ let layout = self.system.layout_watch.borrow();
+ layout.nodes_of(hash, self.replication_factor)
}
fn read_quorum(&self) -> usize {
self.read_quorum
}
fn write_nodes(&self, hash: &Hash) -> Vec<Uuid> {
- let ring = self.system.ring.borrow();
- ring.get_nodes(hash, self.replication_factor)
+ let layout = self.system.layout_watch.borrow();
+ layout.nodes_of(hash, self.replication_factor)
}
fn write_quorum(&self) -> usize {
self.write_quorum
@@ -45,9 +45,9 @@ impl TableReplication for TableShardedReplication {
}
fn partition_of(&self, hash: &Hash) -> Partition {
- self.system.ring.borrow().partition_of(hash)
+ self.system.layout_watch.borrow().partition_of(hash)
}
fn partitions(&self) -> Vec<(Partition, Hash)> {
- self.system.ring.borrow().partitions()
+ self.system.layout_watch.borrow().partitions()
}
}