pub struct Runtime { /* private fields */ }Expand description
Iceberg’s runtime abstraction.
Contains separate handles for IO-bound and CPU-bound work. When constructed
with a single tokio runtime, both io() and cpu() route to the same one.
Use Runtime::new_with_split to provide dedicated runtimes for each
category.
§Lifetime
A Runtime stores only tokio::runtime::Handles (weak references). The
caller owns the tokio runtime’s lifetime. If the underlying runtime is
dropped while iceberg is still using it, subsequent spawns will surface as
task cancellation errors via [JoinHandle].
Cloning is cheap.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn new(runtime: &Runtime) -> Self
pub fn new(runtime: &Runtime) -> Self
Create a Runtime backed by a single tokio runtime for all work.
Sourcepub fn new_with_split(io_runtime: &Runtime, cpu_runtime: &Runtime) -> Self
pub fn new_with_split(io_runtime: &Runtime, cpu_runtime: &Runtime) -> Self
Create a Runtime with separate tokio runtimes for IO and CPU work.
Sourcepub fn current() -> Self
pub fn current() -> Self
Borrows the tokio runtime the caller is currently running in.
Panics if called outside a tokio runtime context. Use
Runtime::try_current for a fallible version.
Iceberg never implicitly spawns its own runtime; callers outside a
tokio context must construct one explicitly via Runtime::new or
Runtime::new_with_split.
Sourcepub fn try_current() -> Result<Self>
pub fn try_current() -> Result<Self>
Fallible variant of Runtime::current. Returns an error if no tokio
runtime is available in the current context.
Sourcepub fn io(&self) -> &RuntimeHandle
pub fn io(&self) -> &RuntimeHandle
Handle for IO-bound work (network fetches, file reads).
Sourcepub fn cpu(&self) -> &RuntimeHandle
pub fn cpu(&self) -> &RuntimeHandle
Handle for CPU-bound work (decoding, predicate eval, projection).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Runtime
impl RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl UnwindSafe for Runtime
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more