aboutsummaryrefslogtreecommitdiff
path: root/src/api_server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-11 23:53:32 +0200
committerAlex Auvolat <alex@adnab.me>2020-04-11 23:53:32 +0200
commit9c931f5edacbaaab746ecf180fac2dd7062d0336 (patch)
treef29cfd82f573ac871408256a33e11f9153bae1da /src/api_server.rs
parent5dd59e437d5af84dfa2cf5dcc2c15807b971002d (diff)
downloadgarage-9c931f5edacbaaab746ecf180fac2dd7062d0336.tar.gz
garage-9c931f5edacbaaab746ecf180fac2dd7062d0336.zip
Keep network status & ring in a tokio::sync::watch
advantages - reads don't prevent preparing writes - can be followed from other parts of the system by cloning the receiver
Diffstat (limited to 'src/api_server.rs')
-rw-r--r--src/api_server.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/api_server.rs b/src/api_server.rs
index 53c3e176..52f33969 100644
--- a/src/api_server.rs
+++ b/src/api_server.rs
@@ -212,9 +212,9 @@ async fn put_block_meta(
async fn put_block(garage: Arc<Garage>, hash: Hash, data: Vec<u8>) -> Result<(), Error> {
let who = garage
.system
- .members
- .read()
- .await
+ .ring
+ .borrow()
+ .clone()
.walk_ring(&hash, garage.system.config.meta_replication_factor);
rpc_try_call_many(
garage.system.clone(),
@@ -359,9 +359,9 @@ async fn handle_get(
async fn get_block(garage: Arc<Garage>, hash: &Hash) -> Result<Vec<u8>, Error> {
let who = garage
.system
- .members
- .read()
- .await
+ .ring
+ .borrow()
+ .clone()
.walk_ring(&hash, garage.system.config.meta_replication_factor);
let resps = rpc_try_call_many(
garage.system.clone(),