Skip to content

Commit

Permalink
refactor: remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjiang2378 committed Oct 23, 2024
1 parent b0f4158 commit 1bb720d
Showing 1 changed file with 4 additions and 40 deletions.
44 changes: 4 additions & 40 deletions hydro_deploy/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,45 +160,6 @@ pub enum HostTargetType {

pub type HostStrategyGetter = Box<dyn FnOnce(&dyn std::any::Any) -> ServerStrategy>;

/*
pub trait Host: Send + Sync {
fn target_type(&self) -> HostTargetType;
fn request_port(&self, bind_type: &ServerStrategy);
/// An identifier for this host, which is unique within a deployment.
fn id(&self) -> usize;
/// Configures the host to support copying and running a custom binary.
fn request_custom_binary(&self);
/// Makes requests for physical resources (servers) that this host needs to run.
///
/// This should be called before `provision` is called.
fn collect_resources(&self, resource_batch: &mut ResourceBatch);
/// Connects to the acquired resources and prepares the host to run services.
///
/// This should be called after `collect_resources` is called.
async fn provision(&self, resource_result: &Arc<ResourceResult>) -> Arc<dyn LaunchedHost>;
fn launched(&self) -> Option<Arc<dyn LaunchedHost>>;
/// 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.
fn strategy_as_server<'a>(
&'a self,
connection_from: &dyn Host,
) -> Result<(ClientStrategy<'a>, HostStrategyGetter)>;
/// Determines whether this host can connect to another host using the given strategy.
fn can_connect_to(&self, typ: ClientStrategy) -> bool;
/// Returns a reference to the host as a trait object.
fn as_any(&self) -> &dyn std::any::Any;
}
*/
#[async_trait]
pub trait Host: Send + Sync {
fn target_type(&self) -> HostTargetType;
Expand All @@ -215,16 +176,19 @@ pub trait Host: Send + Sync {
fn request_custom_binary(&self);

/// Makes requests for physical resources (servers) that this host needs to run.
///
/// This should be called before `provision` is called.
fn collect_resources(&self, resource_batch: &mut ResourceBatch);

/// Connects to the acquired resources and prepares the host to run services.
///
/// This should be called after `collect_resources` is called.
async fn provision(&self, resource_result: &Arc<ResourceResult>) -> Arc<dyn LaunchedHost>;

fn launched(&self) -> Option<Arc<dyn LaunchedHost>>;

/// 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.
fn strategy_as_server<'a>(
&'a self,
connection_from: &dyn Host,
Expand Down

0 comments on commit 1bb720d

Please sign in to comment.