2026-02-19 11:53:46 +01:00
|
|
|
use std::io;
|
|
|
|
|
|
2026-02-02 07:19:22 +01:00
|
|
|
use async_trait::async_trait;
|
|
|
|
|
|
|
|
|
|
use crate::{
|
2026-02-22 03:52:27 +01:00
|
|
|
scenario::{DynError, ExternalNodeSource, FeedRuntime, NodeClients},
|
2026-02-02 07:19:22 +01:00
|
|
|
topology::DeploymentDescriptor,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// Bundles all backend-specific types used by the core scenario engine.
|
|
|
|
|
#[async_trait]
|
|
|
|
|
pub trait Application: Send + Sync + 'static {
|
|
|
|
|
type Deployment: DeploymentDescriptor + Clone + 'static;
|
|
|
|
|
|
|
|
|
|
type NodeClient: Clone + Send + Sync + 'static;
|
|
|
|
|
|
|
|
|
|
type NodeConfig: Clone + Send + Sync + 'static;
|
|
|
|
|
|
|
|
|
|
type FeedRuntime: FeedRuntime;
|
|
|
|
|
|
2026-02-19 11:53:46 +01:00
|
|
|
/// Build an application node client from a static external source.
|
|
|
|
|
///
|
|
|
|
|
/// Environments that support external nodes should override this.
|
|
|
|
|
fn external_node_client(_source: &ExternalNodeSource) -> Result<Self::NodeClient, DynError> {
|
|
|
|
|
Err(io::Error::other("external node sources are not supported").into())
|
2026-02-19 06:30:43 +01:00
|
|
|
}
|
|
|
|
|
|
2026-02-02 07:19:22 +01:00
|
|
|
async fn prepare_feed(
|
2026-02-22 03:52:27 +01:00
|
|
|
node_clients: NodeClients<Self>,
|
|
|
|
|
) -> Result<(<Self::FeedRuntime as FeedRuntime>::Feed, Self::FeedRuntime), DynError>
|
|
|
|
|
where
|
|
|
|
|
Self: Sized;
|
2026-02-02 07:19:22 +01:00
|
|
|
}
|