Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace async-channel with already exist flume dep #862

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion foyer-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ allocator-api2 = "0.2"
anyhow = "1.0"
# TODO(MrCroxx): use `array_chunks` after `#![feature(array_chunks)]` is stable.
array-util = "1"
async-channel = "2"
auto_enums = { version = "0.8", features = ["futures03"] }
bincode = "1"
bytes = "1"
Expand Down
8 changes: 4 additions & 4 deletions foyer-storage/src/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::{
task::{Context, Poll},
};

use async_channel::{Receiver, Sender};
use flume::{Receiver, Sender};
use foyer_common::{countdown::Countdown, metrics::Metrics};
use futures_core::future::BoxFuture;
use futures_util::{future::Shared, FutureExt};
Expand Down Expand Up @@ -154,7 +154,7 @@ impl RegionManager {
stats: Arc::new(RegionStats::default()),
})
.collect_vec();
let (clean_region_tx, clean_region_rx) = async_channel::unbounded();
let (clean_region_tx, clean_region_rx) = flume::unbounded();

metrics.storage_region_total.absolute(device.regions() as _);
metrics.storage_region_size_bytes.absolute(device.region_size() as _);
Expand Down Expand Up @@ -248,7 +248,7 @@ impl RegionManager {
pub async fn mark_clean(&self, region: RegionId) {
self.inner
.clean_region_tx
.send(self.region(region).clone())
.send_async(self.region(region).clone())
.await
.unwrap();
self.inner.metrics.storage_region_clean.increase(1);
Expand All @@ -261,7 +261,7 @@ impl RegionManager {
let metrics = self.inner.metrics.clone();
GetCleanRegionHandle::new(
async move {
let region = clean_region_rx.recv().await.unwrap();
let region = clean_region_rx.recv_async().await.unwrap();
// The only place to increase the permit.
//
// See comments in `ReclaimRunner::handle()` and `RecoverRunner::run()`.
Expand Down
Loading