#[cfg(feature = "kubernetes")]
pub mod docker;
#[cfg(feature = "kubernetes")]
mod helmfile;
#[cfg(feature = "kubernetes")]
mod kind;
#[cfg(feature = "kubernetes")]
mod kubectl;
#[cfg(feature = "kubernetes")]
pub mod local_kubernetes_net;
pub mod local_net;
#[cfg(all(with_testing, feature = "remote_net"))]
pub mod remote_net;
#[cfg(feature = "kubernetes")]
mod util;
mod wallet;
use anyhow::Result;
use async_trait::async_trait;
use linera_execution::ResourceControlPolicy;
pub use wallet::{ApplicationWrapper, ClientWrapper, Faucet, FaucetOption, NodeService};
#[async_trait]
pub trait LineraNetConfig {
type Net: LineraNet + Sized + Send + Sync + 'static;
async fn instantiate(self) -> Result<(Self::Net, ClientWrapper)>;
async fn policy(&self) -> ResourceControlPolicy;
}
#[async_trait]
pub trait LineraNet {
async fn ensure_is_running(&mut self) -> Result<()>;
async fn make_client(&mut self) -> ClientWrapper;
async fn terminate(&mut self) -> Result<()>;
}
#[derive(Copy, Clone)]
pub enum Network {
Grpc,
Tcp,
Udp,
}
impl Network {
fn internal(&self) -> &'static str {
match self {
Network::Grpc => "{ Grpc = \"ClearText\" }",
Network::Tcp => "{ Simple = \"Tcp\" }",
Network::Udp => "{ Simple = \"Udp\" }",
}
}
fn external(&self) -> &'static str {
match self {
Network::Grpc => "{ Grpc = \"ClearText\" }",
Network::Tcp => "{ Simple = \"Tcp\" }",
Network::Udp => "{ Simple = \"Udp\" }",
}
}
fn external_short(&self) -> &'static str {
match self {
Network::Grpc => "grpc",
Network::Tcp => "tcp",
Network::Udp => "udp",
}
}
}