mod tokio_mt;
pub(crate) use tokio_mt::TokioMultiThreadRuntime;
#[cfg(test)]
pub(crate) mod test_util;
mod shutdown;
pub use shutdown::{ShutdownCompletion, ShutdownError, ShutdownErrorKind};
#[cfg(not(target_family = "wasm"))]
mod managed;
#[cfg(not(target_family = "wasm"))]
pub(crate) use managed::{prepare_components, ManagedExecution};
#[allow(dead_code)]
pub(crate) mod buffer_pool;
pub(crate) mod platform;
pub(crate) mod sizing;
pub(crate) mod sync;
use aws_smithy_runtime_api::client::http::SharedHttpClient;
use crate::runtime::sync::SubmissionGuard;
use crate::scheduler::descriptor::TransferDescriptor;
use crate::transfer::{IoRequest, TransferId};
#[derive(Debug)]
pub(crate) struct ScheduledWork {
pub(crate) item: IoRequest,
pub(crate) descriptor: TransferDescriptor,
}
pub(crate) trait ExecutionRuntime: Send + Sync + std::fmt::Debug {
fn dispatch(&self, batch: &mut SubmissionGuard<'_, ScheduledWork>);
fn shutdown(&self);
fn shutdown_completion(&self) -> Option<ShutdownCompletion>;
fn remove_pending_for_transfer(&self, id: TransferId) -> usize;
fn components(&self) -> &RuntimeComponents;
}
#[derive(Debug, Clone)]
#[cfg_attr(
target_family = "wasm",
expect(dead_code, reason = "read only by the managed runtime's transport")
)]
pub(crate) struct RuntimeHttpOptions {
pub(crate) network_interfaces: Vec<String>,
pub(crate) max_connections_per_host: usize,
}
#[derive(Debug, Clone, Default)]
pub(crate) struct RuntimeComponents {
http_client: Option<SharedHttpClient>,
direct_io: bool,
direct_body_io: bool,
}
impl RuntimeComponents {
pub(crate) fn http_client(&self) -> Option<&SharedHttpClient> {
self.http_client.as_ref()
}
pub(crate) fn direct_io(&self) -> bool {
self.direct_io
}
pub(crate) fn direct_body_io(&self) -> bool {
self.direct_body_io
}
#[cfg(not(target_family = "wasm"))]
pub(crate) fn managed(http_client: Option<SharedHttpClient>) -> Self {
Self {
direct_io: true,
direct_body_io: http_client.is_some(),
http_client,
}
}
pub(crate) fn inline_io() -> Self {
Self {
direct_io: true,
direct_body_io: true,
http_client: None,
}
}
}