Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: fvm type definitions #3531

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/fluvio-hub-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ tempfile = { workspace = true }
toml = { workspace = true }
tracing = { workspace = true }
thiserror = { workspace = true }
url = { workspace = true }
wasmparser = { workspace = true }

fluvio-future = { workspace = true, features = ["task"]}
Expand Down
56 changes: 56 additions & 0 deletions crates/fluvio-hub-util/src/fvm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//! Fluvio Version Manager (FVM) type definitions.

use std::fmt::Display;

use serde::{Deserialize, Serialize};
use url::Url;

pub const ARM_UNKNOWN_LINUX_GNUEABIHF: &str = "arm-unknown-linux-gnueabihf";
pub const ARMV7_UNKNOWN_LINUX_GNUEABIHF: &str = "armv7-unknown-linux-gnueabihf";
pub const X86_64_APPLE_DARWIN: &str = "x86_64-apple-darwin";
pub const AARCH64_APPLE_DARWIN: &str = "aarch64-apple-darwin";
pub const X86_64_PC_WINDOWS_GNU: &str = "x86_64-pc-windows-gnu";

/// Available Rust Targets for Fluvio.
///
/// Refer: https://github.com/infinyon/fluvio/blob/f2c49e126c771d58d24d5f5cb0282a6aaa6b23ca/.github/workflows/ci.yml#L141
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub enum RustTarget {
/// arm-unknown-linux-gnueabihf
ArmUnknownLinuxGnueabihf,
/// armv7-unknown-linux-gnueabihf
Armv7UnknownLinuxGnueabihf,
/// x86_64-apple-darwin
X86_64AppleDarwin,
/// aarch64-apple-darwin
Aarch64AppleDarwin,
/// x86_64-pc-windows-gnu
X86_64PcWindowsGnu,
}

impl Display for RustTarget {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::ArmUnknownLinuxGnueabihf => write!(f, "{}", ARM_UNKNOWN_LINUX_GNUEABIHF),
Self::Armv7UnknownLinuxGnueabihf => write!(f, "{}", ARMV7_UNKNOWN_LINUX_GNUEABIHF),
Self::X86_64AppleDarwin => write!(f, "{}", X86_64_APPLE_DARWIN),
Self::Aarch64AppleDarwin => write!(f, "{}", AARCH64_APPLE_DARWIN),
Self::X86_64PcWindowsGnu => write!(f, "{}", X86_64_PC_WINDOWS_GNU),
}
}
}

/// Artifact download URL
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct Artifact {
name: String,
download_url: Url,
}

/// Fluvio Version Manager Package for a specific architecture and version.
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct PackageSet {
pub version: String,
pub arch: RustTarget,
pub artifacts: Vec<Artifact>,
}
1 change: 1 addition & 0 deletions crates/fluvio-hub-util/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mod fvm;
mod hubaccess;
mod package;
mod package_meta_ext;
Expand Down
Loading