Skip to content

Commit

Permalink
feat(hub): enable repository_url (infinyon#3961)
Browse files Browse the repository at this point in the history
* feat(hub): enable `repository_url` and `repository_commit_sha`

* fix: fmt issues

* fix: rm commit sha
  • Loading branch information
EstebanBorai authored and fraidev committed Apr 23, 2024
1 parent af1fcea commit 96f0ed1
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ k8-diff = { version = "0.1.2" }
trybuild = { branch = "check_option", git = "https://github.com/infinyon/trybuild" }

# Internal fluvio dependencies
fluvio = { version = "0.21.0", path = "crates/fluvio" }
fluvio = { version = "0.22.0", path = "crates/fluvio" }
fluvio-auth = { path = "crates/fluvio-auth" }
fluvio-channel = { path = "crates/fluvio-channel" }
fluvio-cli-common = { path = "crates/fluvio-cli-common"}
Expand Down
3 changes: 2 additions & 1 deletion crates/fluvio-hub-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ publish = false
cargo_toml = { workspace = true }
const_format = { workspace = true }
dirs = { workspace = true }
serde = { workspace = true, features=["derive"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
serde_yaml = { workspace = true }
toml = { workspace = true }
tracing = { workspace = true }
thiserror = { workspace = true }
url = { workspace = true, features = ["serde"] }

fluvio-controlplane-metadata = { workspace = true, features = [ "smartmodule" ] }
fluvio-types = { workspace = true }
10 changes: 5 additions & 5 deletions crates/fluvio-hub-protocol/src/package_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::default::Default;

use serde::{Deserialize, Serialize};
use tracing::{info, error};
use url::Url;

use fluvio_controlplane_metadata::smartmodule::FluvioSemVersion;
use fluvio_controlplane_metadata::smartmodule::SmartModulePackageKey;
Expand All @@ -18,16 +19,14 @@ pub struct PackageMeta {
pub name: String,
pub version: String, // SemVer?, package version
pub group: String,
// author: Option<String>,
pub description: String,
pub license: String,
pub manifest: Vec<String>, // Files in package, package-meta is implied, signature is omitted
pub repository_url: Option<Url>,
pub tags: Option<Vec<PkgTag>>,

#[serde(default = "PackageMeta::visibility_if_missing")]
pub visibility: PkgVisibility, // private is default if missing
pub manifest: Vec<String>, // Files in package, package-meta is implied, signature is omitted
// repository: optional url
// repository-commit: optional hash
pub tags: Option<Vec<PkgTag>>,
}

#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Default, Clone)]
Expand Down Expand Up @@ -56,6 +55,7 @@ impl Default for PackageMeta {
visibility: PkgVisibility::Private,
manifest: Vec::new(),
tags: None,
repository_url: None,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/fluvio/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio"
version = "0.21.9"
version = "0.22.0"
edition = "2021"
license = "Apache-2.0"
authors = ["Fluvio Contributors <team@fluvio.io>"]
Expand Down
23 changes: 22 additions & 1 deletion crates/fluvio/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ use std::fmt::Debug;
use std::io::Error as IoError;
use std::io::ErrorKind;

use fluvio_socket::AsyncResponse;
use futures_util::{Stream, StreamExt};
use tracing::{debug, trace, instrument};
use anyhow::{Result, anyhow};
use anyhow::{anyhow, Result};

use fluvio_protocol::{Decoder, Encoder};
use fluvio_protocol::api::{Request, RequestMessage};
Expand Down Expand Up @@ -340,6 +341,26 @@ impl FluvioAdmin {
)),
}))
}

/// Create a stream for a specific request
#[instrument(skip(self))]
pub async fn create_stream<S, R>(&self, req: R) -> Result<AsyncResponse<S>>
where
S: TryEncodableFrom<R> + Request,
R: Request,
{
let version = self
.socket
.lookup_version::<S>()
.ok_or(anyhow!("no version found watch request {}", S::API_KEY))?;
let req = S::try_encode_from(req, version)?;
let req_msg = RequestMessage::new_request(req);
let inner_socket = self.socket.new_socket();
inner_socket
.create_stream(req_msg, 10)
.await
.map_err(|err| anyhow!("socket error: {}", err))
}
}

/// API for streaming cached metadata
Expand Down

0 comments on commit 96f0ed1

Please sign in to comment.