Trait tsunami::Tsunami [−][src]
Use this trait to launch machines into providers.
Important: You must call terminate_all
to shut down the instances once you are done.
Otherwise, you may incur unexpected charges from the cloud provider.
This trait is sealed. If you want to implement support for a provider, see
providers::Launcher
.
Associated Types
type MachineDescriptor: MachineSetup
[src]
A type describing a single instance to launch.
Required methods
fn spawn<'l, I>(
&'l mut self,
descriptors: I,
max_wait: Option<Duration>
) -> Pin<Box<dyn Future<Output = Result<(), Report>> + Send + 'l>> where
I: IntoIterator<Item = (String, Self::MachineDescriptor)> + Send + 'static,
I: Debug,
I::IntoIter: Send,
[src]
&'l mut self,
descriptors: I,
max_wait: Option<Duration>
) -> Pin<Box<dyn Future<Output = Result<(), Report>> + Send + 'l>> where
I: IntoIterator<Item = (String, Self::MachineDescriptor)> + Send + 'static,
I: Debug,
I::IntoIter: Send,
Start up all the hosts.
The returned future will resolve when the instances are spawned into the provided launcher.
SSH connections to each instance are accesssible via
connect_all
.
The argument descriptors
is an iterator of machine nickname to descriptor. Duplicate
nicknames will cause an error. To add many and auto-generate nicknames, see the helper
function crate::make_multiple
.
max_wait
limits how long we should wait for instances to be available before giving up.
Passing None
implies no limit.
Example
#[tokio::main] async fn main() -> Result<(), color_eyre::Report> { use tsunami::Tsunami; // make a launcher let mut aws: tsunami::providers::aws::Launcher<_> = Default::default(); // spawn a host into the launcher aws.spawn(vec![(String::from("my_tsunami"), Default::default())], None).await?; // access the host via the launcher let vms = aws.connect_all().await?; // we're done! terminate the instance. aws.terminate_all().await?; Ok(()) }
fn connect_all<'l>(
&'l self
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Machine<'l>>, Report>> + Send + 'l>>
[src]
&'l self
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Machine<'l>>, Report>> + Send + 'l>>
Return connections to the Machine
s that spawn
spawned.
fn terminate_all(
self
) -> Pin<Box<dyn Future<Output = Result<(), Report>> + Send>>
[src]
self
) -> Pin<Box<dyn Future<Output = Result<(), Report>> + Send>>
Shut down all instances.
Implementors
impl<L: Launcher> Tsunami for L
[src]
type MachineDescriptor = L::MachineDescriptor
fn connect_all<'l>(
&'l self
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Machine<'l>>, Report>> + Send + 'l>>
[src]
&'l self
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Machine<'l>>, Report>> + Send + 'l>>
fn terminate_all(
self
) -> Pin<Box<dyn Future<Output = Result<(), Report>> + Send>>
[src]
self
) -> Pin<Box<dyn Future<Output = Result<(), Report>> + Send>>
fn spawn<'l, I>(
&'l mut self,
descriptors: I,
max_wait: Option<Duration>
) -> Pin<Box<dyn Future<Output = Result<(), Report>> + Send + 'l>> where
I: IntoIterator<Item = (String, Self::MachineDescriptor)> + Send + 'static,
I: Debug,
I::IntoIter: Send,
[src]
&'l mut self,
descriptors: I,
max_wait: Option<Duration>
) -> Pin<Box<dyn Future<Output = Result<(), Report>> + Send + 'l>> where
I: IntoIterator<Item = (String, Self::MachineDescriptor)> + Send + 'static,
I: Debug,
I::IntoIter: Send,