diff options
author | Alex Auvolat <alex@adnab.me> | 2022-07-18 17:18:47 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-07-29 12:24:44 +0200 |
commit | 1b2e1296eb99630e969e585ede0424072adc2d0c (patch) | |
tree | e16b953e1f53e57c6efd11e688e955fa36cbb186 /src/block/manager.rs | |
parent | a184f0d0b5f1d84524f7ba7302a4919567acec56 (diff) | |
download | garage-1b2e1296eb99630e969e585ede0424072adc2d0c.tar.gz garage-1b2e1296eb99630e969e585ede0424072adc2d0c.zip |
Compute hashes on dedicated threads
Diffstat (limited to 'src/block/manager.rs')
-rw-r--r-- | src/block/manager.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/block/manager.rs b/src/block/manager.rs index 017ba9da..890c247d 100644 --- a/src/block/manager.rs +++ b/src/block/manager.rs @@ -5,6 +5,7 @@ use std::time::Duration; use arc_swap::ArcSwapOption; use async_trait::async_trait; +use bytes::Bytes; use serde::{Deserialize, Serialize}; use futures::future::*; @@ -211,14 +212,15 @@ impl BlockManager { } /// Send block to nodes that should have it - pub async fn rpc_put_block(&self, hash: Hash, data: Vec<u8>) -> Result<(), Error> { + pub async fn rpc_put_block(&self, hash: Hash, data: Bytes) -> Result<(), Error> { let who = self.replication.write_nodes(&hash); - let data = DataBlock::from_buffer(data, self.compression_level); + let data = DataBlock::from_buffer(data, self.compression_level).await; self.system .rpc .try_call_many( &self.endpoint, &who[..], + // TODO: remove to_vec() here BlockRpc::PutBlock { hash, data }, RequestStrategy::with_priority(PRIO_NORMAL) .with_quorum(self.replication.write_quorum()) |