Skip to content
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
5 changes: 5 additions & 0 deletions vortex-io/src/file/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ use std::pin::Pin;
use std::task::{Context, Poll};

use futures::Stream;
#[cfg(all(test, not(feature = "tokio")))]
use oneshot;
use pin_project_lite::pin_project;
// Prefer tokio::sync::oneshot when tokio feature is enabled
#[cfg(all(test, feature = "tokio"))]
use tokio::sync::oneshot;
use vortex_error::VortexExpect;
use vortex_metrics::VortexMetrics;

Expand Down
5 changes: 5 additions & 0 deletions vortex-io/src/file/read/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ use async_trait::async_trait;
use futures::channel::mpsc;
use futures::future::{BoxFuture, Shared};
use futures::{FutureExt, TryFutureExt};
#[cfg(not(feature = "tokio"))]
use oneshot;
pub use request::*;
pub use source::*;
// Prefer tokio::sync::oneshot when tokio feature is enabled
#[cfg(feature = "tokio")]
use tokio::sync::oneshot;
use vortex_buffer::{Alignment, ByteBuffer};
use vortex_error::{SharedVortexResult, VortexError, VortexResult, vortex_err};

Expand Down
11 changes: 11 additions & 0 deletions vortex-io/src/file/read/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ use std::fmt::{Debug, Formatter};
use std::ops::Range;
use std::sync::Arc;

#[cfg(not(feature = "tokio"))]
use oneshot;
// Prefer tokio::sync::oneshot when tokio feature is enabled
#[cfg(feature = "tokio")]
use tokio::sync::oneshot;
use vortex_buffer::{Alignment, ByteBuffer};
use vortex_error::{VortexError, VortexExpect, VortexResult};

Expand Down Expand Up @@ -118,6 +123,12 @@ impl Debug for ReadRequest {

impl ReadRequest {
pub(crate) fn resolve(self, result: VortexResult<ByteBuffer>) {
// tokio::sync::oneshot::Sender::send returns Err with the value if receiver dropped
#[cfg(feature = "tokio")]
if self.callback.send(result).is_err() {
log::debug!("ReadRequest {} dropped before resolving", self.id);
}
#[cfg(not(feature = "tokio"))]
if let Err(e) = self.callback.send(result) {
log::debug!("ReadRequest {} dropped before resolving: {e}", self.id);
}
Expand Down
5 changes: 5 additions & 0 deletions vortex-io/src/runtime/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ use std::task::{Context, Poll, ready};

use futures::channel::mpsc;
use futures::{FutureExt, StreamExt};
#[cfg(not(feature = "tokio"))]
use oneshot;
// Prefer tokio::sync::oneshot when tokio feature is enabled
#[cfg(feature = "tokio")]
use tokio::sync::oneshot;
use vortex_error::{VortexResult, vortex_panic};
use vortex_metrics::VortexMetrics;

Expand Down
5 changes: 5 additions & 0 deletions vortex-io/src/runtime/single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ use std::sync::Arc;
use futures::future::BoxFuture;
use futures::stream::LocalBoxStream;
use futures::{Stream, StreamExt};
#[cfg(not(feature = "tokio"))]
use oneshot;
use parking_lot::Mutex;
use smol::LocalExecutor;
// Prefer tokio::sync::oneshot when tokio feature is enabled
#[cfg(feature = "tokio")]
use tokio::sync::oneshot;
use vortex_error::vortex_panic;

use crate::runtime::smol::SmolAbortHandle;
Expand Down
Loading