Skip to content

Commit

Permalink
Remove tokio_shim
Browse files Browse the repository at this point in the history
Summary: Not needed anymore since we don't use tokio 0.x.

Reviewed By: dtolnay

Differential Revision: D52063174

fbshipit-source-id: 8505d1f02a06570b516bac13ddfb75ae135be895
  • Loading branch information
zertosh authored and facebook-github-bot committed Dec 12, 2023
1 parent 6cbbbbc commit ec87015
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 358 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,4 @@ members = [
"shed/thrift_compiler",
"shed/time_ext",
"shed/tokio-uds-compat",
"shed/tokio_shim",
]
3 changes: 1 addition & 2 deletions shed/futures_ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ futures = { version = "0.3.28", features = ["async-await", "compat"] }
pin-project = "0.4.30"
shared_error = { version = "0.1.0", path = "../shared_error" }
thiserror = "1.0.49"
tokio_shim = { version = "0.1.0", path = "../tokio_shim" }
tokio = { version = "1.29.1", features = ["full", "test-util", "tracing"] }

[dev-dependencies]
assert_matches = "1.5"
async-stream = "0.3"
tokio = { version = "1.29.1", features = ["full", "test-util", "tracing"] }
4 changes: 2 additions & 2 deletions shed/futures_ext/src/future/abort_handle_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use futures::future::AbortHandle;

/// Spawns a new task returning an abort handle for it.
///
/// It is similar to [tokio_shim::task::spawn] but instad of returning a JoinHandle it will return
/// It is similar to [tokio::task::spawn] but instad of returning a JoinHandle it will return
/// an [ControlledHandle]. The [ControlledHandle] can be used to directly abort the task that was
/// spawned. [ControlledHandle] can be cloned resulting in a new handle to the same underlying
/// task. Dropping all [ControlledHandle] instances pointing to a given task will result in the
Expand All @@ -30,7 +30,7 @@ where
T::Output: Send + 'static,
{
let (abortable_future, abort_handle) = abortable(t);
tokio_shim::task::spawn(abortable_future);
tokio::task::spawn(abortable_future);
ControlledHandle::new(abort_handle)
}

Expand Down
6 changes: 3 additions & 3 deletions shed/futures_ext/src/future/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use futures::future::Future;
use futures::future::FutureExt;
use futures::future::TryFuture;
pub use shared_error::anyhow::SharedError;
use tokio_shim::time::Timeout;
use tokio::time::Timeout;

pub use self::abort_handle_ref::spawn_controlled;
pub use self::abort_handle_ref::ControlledHandle;
Expand All @@ -35,12 +35,12 @@ pub use self::try_shared::TryShared;
/// A trait implemented by default for all Futures which extends the standard
/// functionality.
pub trait FbFutureExt: Future {
/// Construct a new [tokio_shim::time::Timeout].
/// Construct a new [tokio::time::Timeout].
fn timeout(self, timeout: Duration) -> Timeout<Self>
where
Self: Sized,
{
tokio_shim::time::timeout(timeout, self)
tokio::time::timeout(timeout, self)
}

/// Call the `on_cancel` callback if this future is canceled (dropped
Expand Down
4 changes: 2 additions & 2 deletions shed/futures_ext/src/stream/stream_with_timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use futures::task::Context;
use futures::task::Poll;
use pin_project::pin_project;
use thiserror::Error;
use tokio_shim::time::Sleep;
use tokio::time::Sleep;

/// Error returned when a StreamWithTimeout exceeds its deadline.
#[derive(Debug, Error)]
Expand Down Expand Up @@ -60,7 +60,7 @@ impl<S: Stream> Stream for StreamWithTimeout<S> {
let duration = *this.duration;

if this.deadline.is_none() {
this.deadline.set(Some(tokio_shim::time::sleep(duration)));
this.deadline.set(Some(tokio::time::sleep(duration)));
}

// NOTE: This unwrap() is safe as we just set the value.
Expand Down
2 changes: 1 addition & 1 deletion shed/sql/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rusqlite = { version = "0.29.0", features = ["backup", "blob", "column_decltype"
stats = { version = "0.1.0", path = "../../stats" }
thiserror = "1.0.49"
time_ext = { version = "0.1.0", path = "../../time_ext" }
tokio_shim = { version = "0.1.0", path = "../../tokio_shim" }
tokio = { version = "1.29.1", features = ["full", "test-util", "tracing"] }
vec1 = { version = "1", features = ["serde"] }

[dev-dependencies]
Expand Down
4 changes: 1 addition & 3 deletions shed/stats/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ futures = { version = "0.3.28", features = ["async-await", "compat"] }
once_cell = "1.12"
perthread = { version = "0.1.0", path = "../perthread" }
stats_traits = { version = "0.1.0", path = "traits" }
tokio_shim = { version = "0.1.0", path = "../tokio_shim" }

[dev-dependencies]
tokio = { version = "1.29.1", features = ["full", "test-util", "tracing"] }
tokio-stream = { version = "0.1.14", features = ["fs", "io-util", "net", "signal", "sync", "time"] }
3 changes: 2 additions & 1 deletion shed/stats/src/thread_local_aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ pub fn create_map() -> Arc<ThreadMap<BoxStatsManager>> {
/// ```
pub fn schedule_stats_aggregation_preview() -> Result<SchedulerPreview, StatsScheduledErrorPreview>
{
let stream = tokio_shim::time::interval_stream(Duration::from_secs(1));
let stream =
tokio_stream::wrappers::IntervalStream::new(tokio::time::interval(Duration::from_secs(1)));
let scheduler = schedule_stats_on_stream_preview(stream);

if STATS_SCHEDULED.swap(true, atomic::Ordering::Relaxed) {
Expand Down
20 changes: 0 additions & 20 deletions shed/tokio_shim/Cargo.toml

This file was deleted.

Loading

0 comments on commit ec87015

Please sign in to comment.