Skip to content

Commit

Permalink
feat(hydro_deploy): add architecture enum
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjiang2378 committed Apr 12, 2024
1 parent 76e501a commit 97abb81
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hydro_deploy/core/src/azure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl AzureHost {
#[async_trait]
impl Host for AzureHost {
fn target_type(&self) -> HostTargetType {
HostTargetType::Linux
HostTargetType::Linux(crate::LinuxArchitecture::AARCH64)
}

fn request_port(&mut self, bind_type: &ServerStrategy) {
Expand Down
2 changes: 1 addition & 1 deletion hydro_deploy/core/src/gcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl GCPComputeEngineHost {
#[async_trait]
impl Host for GCPComputeEngineHost {
fn target_type(&self) -> HostTargetType {
HostTargetType::Linux
HostTargetType::Linux(crate::LinuxArchitecture::AARCH64)
}

fn request_port(&mut self, bind_type: &ServerStrategy) {
Expand Down
7 changes: 5 additions & 2 deletions hydro_deploy/core/src/hydroflow_crate/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use once_cell::sync::Lazy;
use tokio::sync::OnceCell;

use crate::progress::ProgressTracker;
use crate::HostTargetType;
use crate::{HostTargetType, LinuxArchitecture};

#[derive(PartialEq, Eq, Hash)]
struct CacheKey {
Expand Down Expand Up @@ -81,9 +81,12 @@ pub async fn build_crate(

match target_type {
HostTargetType::Local => {}
HostTargetType::Linux => {
HostTargetType::Linux(LinuxArchitecture::X86_64) => {
command.args(["--target", "x86_64-unknown-linux-musl"]);
}
HostTargetType::Linux(LinuxArchitecture::AARCH64) => {
command.args(["--target", "aarch64-unknown-linux-musl"]);
}
}

if let Some(features) = features {
Expand Down
9 changes: 8 additions & 1 deletion hydro_deploy/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,17 @@ pub enum ClientStrategy<'a> {
),
}

// Architecture for binary
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum LinuxArchitecture {
X86_64,
AARCH64,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum HostTargetType {
Local,
Linux,
Linux(LinuxArchitecture),
}

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

0 comments on commit 97abb81

Please sign in to comment.