Skip to content

Commit c7dba8c

Browse files
authored
chore: rename IoDispatcher::default() -> IoDispatcher::shared (#2940)
I think it's clearer for consumers that the default is spawning onto a shared async runtime
1 parent a293e03 commit c7dba8c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

vortex-file/src/generic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl Default for GenericFileOptions {
152152
fn default() -> Self {
153153
Self {
154154
io_concurrency: 8,
155-
io_dispatcher: IoDispatcher::default(),
155+
io_dispatcher: IoDispatcher::shared(),
156156
}
157157
}
158158
}

vortex-io/src/dispatcher/mod.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use futures::FutureExt;
1414
use futures::channel::oneshot;
1515
use vortex_error::{VortexResult, vortex_err};
1616

17-
static DEFAULT: LazyLock<IoDispatcher> = LazyLock::new(IoDispatcher::new);
17+
static SHARED: LazyLock<IoDispatcher> = LazyLock::new(IoDispatcher::new);
1818

1919
#[cfg(feature = "compio")]
2020
use self::compio::*;
@@ -108,8 +108,14 @@ impl IoDispatcher {
108108

109109
impl Default for IoDispatcher {
110110
fn default() -> Self {
111-
// By default, we return a shared handle
112-
DEFAULT.clone()
111+
Self::new()
112+
}
113+
}
114+
115+
impl IoDispatcher {
116+
/// Returns a handle to the current process's shared Dispatcher.
117+
pub fn shared() -> Self {
118+
SHARED.clone()
113119
}
114120
}
115121

0 commit comments

Comments
 (0)