Trait hydro_deploy::Host
source · pub trait Host: Send + Sync {
// Required methods
fn target_type(&self) -> HostTargetType;
fn request_port(&self, bind_type: &ServerStrategy);
fn id(&self) -> usize;
fn request_custom_binary(&self);
fn collect_resources(&self, resource_batch: &mut ResourceBatch);
fn provision(
&self,
resource_result: &Arc<ResourceResult>,
) -> Arc<dyn LaunchedHost>;
fn launched(&self) -> Option<Arc<dyn LaunchedHost>>;
fn strategy_as_server<'a>(
&'a self,
connection_from: &dyn Host,
) -> Result<(ClientStrategy<'a>, HostStrategyGetter)>;
fn can_connect_to(&self, typ: ClientStrategy<'_>) -> bool;
fn as_any(&self) -> &dyn Any;
}
Required Methods§
fn target_type(&self) -> HostTargetType
fn request_port(&self, bind_type: &ServerStrategy)
sourcefn request_custom_binary(&self)
fn request_custom_binary(&self)
Configures the host to support copying and running a custom binary.
sourcefn collect_resources(&self, resource_batch: &mut ResourceBatch)
fn collect_resources(&self, resource_batch: &mut ResourceBatch)
Makes requests for physical resources (servers) that this host needs to run.
This should be called before provision
is called.
sourcefn provision(
&self,
resource_result: &Arc<ResourceResult>,
) -> Arc<dyn LaunchedHost>
fn provision( &self, resource_result: &Arc<ResourceResult>, ) -> Arc<dyn LaunchedHost>
Connects to the acquired resources and prepares the host to run services.
This should be called after collect_resources
is called.
fn launched(&self) -> Option<Arc<dyn LaunchedHost>>
sourcefn strategy_as_server<'a>(
&'a self,
connection_from: &dyn Host,
) -> Result<(ClientStrategy<'a>, HostStrategyGetter)>
fn strategy_as_server<'a>( &'a self, connection_from: &dyn Host, ) -> Result<(ClientStrategy<'a>, HostStrategyGetter)>
Identifies a network type that this host can use for connections if it is the server.
The host will be None
if the connection is from the same host as the target.
sourcefn can_connect_to(&self, typ: ClientStrategy<'_>) -> bool
fn can_connect_to(&self, typ: ClientStrategy<'_>) -> bool
Determines whether this host can connect to another host using the given strategy.