Skip to content

Commit

Permalink
chore: Update wnfs-common to 0.1.26
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed Dec 28, 2023
1 parent cb57d41 commit f029a98
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
24 changes: 20 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions car-mirror-benches/benches/artificially_slow_blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use car_mirror::{
use criterion::{criterion_group, criterion_main, BatchSize, Criterion};
use libipld::Cid;
use std::time::Duration;
use wnfs_common::{BlockStore, MemoryBlockStore};
use wnfs_common::{utils::CondSend, BlockStore, MemoryBlockStore};

pub fn push_throttled(c: &mut Criterion) {
let mut rvg = car_mirror::test_utils::Rvg::deterministic();
Expand Down Expand Up @@ -109,15 +109,16 @@ pub fn pull_throttled(c: &mut Criterion) {
#[derive(Debug, Clone)]
struct ThrottledBlockStore(MemoryBlockStore);

#[async_trait(?Send)]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
impl BlockStore for ThrottledBlockStore {
async fn get_block(&self, cid: &Cid) -> Result<Bytes> {
let bytes = self.0.get_block(cid).await?;
async_std::task::sleep(Duration::from_micros(50)).await; // Block fetching is artifically slowed by 50 microseconds
Ok(bytes)
}

async fn put_block(&self, bytes: impl Into<Bytes>, codec: u64) -> Result<Cid> {
async fn put_block(&self, bytes: impl Into<Bytes> + CondSend, codec: u64) -> Result<Cid> {
self.0.put_block(bytes, codec).await
}
}
Expand Down
2 changes: 1 addition & 1 deletion car-mirror/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ thiserror = "1.0"
tokio = { version = "^1", default-features = false }
tracing = "0.1"
tracing-subscriber = "0.3"
wnfs-common = "0.1.24"
wnfs-common = "0.1.26"

[dev-dependencies]
async-std = { version = "1.11", features = ["attributes"] }
Expand Down

0 comments on commit f029a98

Please sign in to comment.