Skip to content

Commit

Permalink
chore(rust version): update all crates to use newer rust and referenc…
Browse files Browse the repository at this point in the history
…e from workspace version

Signed-off-by: Kate Goldenring <[email protected]>
  • Loading branch information
kate-goldenring committed Oct 2, 2024
1 parent 7c8242a commit 5361378
Show file tree
Hide file tree
Showing 24 changed files with 1,245 additions and 1,093 deletions.
1,394 changes: 662 additions & 732 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ members = [
"discovery-handler-modules/udev-discovery-handler",
]
resolver = "2"

[workspace.package]
version = "0.13.2"
edition = "2021"
license = "Apache-2.0"
homepage = "https://docs.akri.sh/"
repository = "https://github.com/project-akri/akri"
rust-version = "1.79"
11 changes: 1 addition & 10 deletions Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,4 @@ passthrough = [
"PKG_CONFIG_ALLOW_CROSS",
"RUST_LOG",
"CARGO_INCREMENTAL",
]

[target.x86_64-unknown-linux-gnu]
image = "ghcr.io/project-akri/akri/rust-crossbuild:x86_64-unknown-linux-gnu-0.1.16-0.0.7"

[target.armv7-unknown-linux-gnueabihf]
image = "ghcr.io/project-akri/akri/rust-crossbuild:armv7-unknown-linux-gnueabihf-0.1.16-0.0.7"

[target.aarch64-unknown-linux-gnu]
image = "ghcr.io/project-akri/akri/rust-crossbuild:aarch64-unknown-linux-gnu-0.1.16-0.0.7"
]
10 changes: 6 additions & 4 deletions agent/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[package]
name = "agent"
version = "0.13.2"
license = "Apache-2.0"
authors = ["Kate Goldenring <[email protected]>", "<[email protected]>"]
edition = "2021"
rust-version = "1.73.0"
version.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
rust-version.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
1 change: 1 addition & 0 deletions agent/src/device_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ use mockall::automock;
#[cfg_attr(test, automock)]
pub trait DeviceManager: Send + Sync {
fn get(&self, fqdn: &str) -> Option<cdi::Device>;
#[allow(dead_code)]
fn has_device(&self, fqdn: String) -> bool;
}
132 changes: 84 additions & 48 deletions agent/src/plugin_manager/v1.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AllocatableResourcesRequest {}
Expand Down Expand Up @@ -86,8 +87,8 @@ pub struct NumaNode {
/// Generated client implementations.
pub mod pod_resources_lister_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// PodResourcesLister is a service provided by the kubelet that provides information about the
/// node resources consumed by pods and containers on the node
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -133,8 +134,9 @@ pub mod pod_resources_lister_client {
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
PodResourcesListerClient::new(InterceptedService::new(inner, interceptor))
}
Expand Down Expand Up @@ -172,16 +174,23 @@ pub mod pod_resources_lister_client {
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListPodResourcesRequest>,
) -> std::result::Result<tonic::Response<super::ListPodResourcesResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
) -> std::result::Result<
tonic::Response<super::ListPodResourcesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/v1.PodResourcesLister/List");
let path = http::uri::PathAndQuery::from_static(
"/v1.PodResourcesLister/List",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("v1.PodResourcesLister", "List"));
Expand All @@ -190,23 +199,28 @@ pub mod pod_resources_lister_client {
pub async fn get_allocatable_resources(
&mut self,
request: impl tonic::IntoRequest<super::AllocatableResourcesRequest>,
) -> std::result::Result<tonic::Response<super::AllocatableResourcesResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
) -> std::result::Result<
tonic::Response<super::AllocatableResourcesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/v1.PodResourcesLister/GetAllocatableResources",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"v1.PodResourcesLister",
"GetAllocatableResources",
));
req.extensions_mut()
.insert(
GrpcMethod::new("v1.PodResourcesLister", "GetAllocatableResources"),
);
self.inner.unary(req, path, codec).await
}
}
Expand All @@ -221,11 +235,17 @@ pub mod pod_resources_lister_server {
async fn list(
&self,
request: tonic::Request<super::ListPodResourcesRequest>,
) -> std::result::Result<tonic::Response<super::ListPodResourcesResponse>, tonic::Status>;
) -> std::result::Result<
tonic::Response<super::ListPodResourcesResponse>,
tonic::Status,
>;
async fn get_allocatable_resources(
&self,
request: tonic::Request<super::AllocatableResourcesRequest>,
) -> std::result::Result<tonic::Response<super::AllocatableResourcesResponse>, tonic::Status>;
) -> std::result::Result<
tonic::Response<super::AllocatableResourcesResponse>,
tonic::Status,
>;
}
/// PodResourcesLister is a service provided by the kubelet that provides information about the
/// node resources consumed by pods and containers on the node
Expand All @@ -252,7 +272,10 @@ pub mod pod_resources_lister_server {
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
Expand Down Expand Up @@ -308,11 +331,15 @@ pub mod pod_resources_lister_server {
"/v1.PodResourcesLister/List" => {
#[allow(non_camel_case_types)]
struct ListSvc<T: PodResourcesLister>(pub Arc<T>);
impl<T: PodResourcesLister>
tonic::server::UnaryService<super::ListPodResourcesRequest> for ListSvc<T>
{
impl<
T: PodResourcesLister,
> tonic::server::UnaryService<super::ListPodResourcesRequest>
for ListSvc<T> {
type Response = super::ListPodResourcesResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListPodResourcesRequest>,
Expand Down Expand Up @@ -350,22 +377,26 @@ pub mod pod_resources_lister_server {
"/v1.PodResourcesLister/GetAllocatableResources" => {
#[allow(non_camel_case_types)]
struct GetAllocatableResourcesSvc<T: PodResourcesLister>(pub Arc<T>);
impl<T: PodResourcesLister>
tonic::server::UnaryService<super::AllocatableResourcesRequest>
for GetAllocatableResourcesSvc<T>
{
impl<
T: PodResourcesLister,
> tonic::server::UnaryService<super::AllocatableResourcesRequest>
for GetAllocatableResourcesSvc<T> {
type Response = super::AllocatableResourcesResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AllocatableResourcesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as PodResourcesLister>::get_allocatable_resources(
&inner, request,
)
.await
&inner,
request,
)
.await
};
Box::pin(fut)
}
Expand Down Expand Up @@ -393,14 +424,18 @@ pub mod pod_resources_lister_server {
};
Box::pin(fut)
}
_ => Box::pin(async move {
Ok(http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap())
}),
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
Expand All @@ -426,7 +461,8 @@ pub mod pod_resources_lister_server {
write!(f, "{:?}", self.0)
}
}
impl<T: PodResourcesLister> tonic::server::NamedService for PodResourcesListerServer<T> {
impl<T: PodResourcesLister> tonic::server::NamedService
for PodResourcesListerServer<T> {
const NAME: &'static str = "v1.PodResourcesLister";
}
}
Loading

0 comments on commit 5361378

Please sign in to comment.