CTTY opened a new issue, #1958:
URL: https://github.com/apache/iceberg-rust/issues/1958
Iceberg-rust provides a centralized Runtime used to spawn parallelizable
work (e.g., table scans, loading delete files). Today our runtime crate exposes
a JoinHandle that is essentially just a thin wrapper around Tokio’s handle and
offers little configurability:
```rust
pub struct JoinHandle<T>(task::JoinHandle<T>);
```
Tokio has a rich set of runtime knobs (thread counts, blocking pool size,
thread naming, etc.), but our current abstraction doesn’t give users a good way
to tune these settings.
There are two broad directions:
#### Option A: Make Runtime pluggable
Expose a Runtime trait so users can provide their own runtime implementation.
One possible shape:
```rust
pub trait Runtime: Send + Sync + 'static {
fn spawn<T>(
&self,
fut: std::pin::Pin<Box<dyn Future<Output = T> + Send + 'static>>,
) -> std::pin::Pin<Box<dyn Future<Output = T> + Send + 'static>>
where
T: Send + 'static;
fn spawn_blocking<T>(
&self,
f: Box<dyn FnOnce() -> T + Send + 'static>,
) -> std::pin::Pin<Box<dyn Future<Output = T> + Send + 'static>>
where
T: Send + 'static;
}
```
Pros:
- Maximum flexibility: users can integrate with whatever executor/runtime
they already use.
Cons:
- More complexity for users (they may need to build/manage a runtime).
#### Option B: Expose Tokio runtime configuration
Keep Tokio as the default runtime, but add a RuntimeConfig that maps to
Tokio’s builder options.
Pros:
- Straightforward for most users
Cons:
- Less flexible: users are effectively opting into Tokio (though in practice
many already are).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]