feat: able to run containers
This commit is contained in:
@@ -12,6 +12,24 @@ pub struct PublishResponse {
|
||||
}
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetTopicRequest {
|
||||
#[prost(string, tag="1")]
|
||||
pub topic: ::prost::alloc::string::String,
|
||||
}
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetTopicResponse {
|
||||
#[prost(message, optional, tag="1")]
|
||||
pub projects: ::core::option::Option<Projects>,
|
||||
}
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Projects {
|
||||
#[prost(message, repeated, tag="1")]
|
||||
pub projects: ::prost::alloc::vec::Vec<Project>,
|
||||
}
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Project {
|
||||
#[prost(string, tag="1")]
|
||||
pub name: ::prost::alloc::string::String,
|
||||
|
@@ -4,6 +4,7 @@ pub mod registry_service_client {
|
||||
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
|
||||
use tonic::codegen::*;
|
||||
use tonic::codegen::http::Uri;
|
||||
///
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RegistryServiceClient<T> {
|
||||
inner: tonic::client::Grpc<T>,
|
||||
@@ -84,6 +85,7 @@ pub mod registry_service_client {
|
||||
self.inner = self.inner.max_encoding_message_size(limit);
|
||||
self
|
||||
}
|
||||
///
|
||||
pub async fn publish(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::PublishRequest>,
|
||||
@@ -109,6 +111,32 @@ pub mod registry_service_client {
|
||||
.insert(GrpcMethod::new("norun.v1.RegistryService", "Publish"));
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
///
|
||||
pub async fn get_topic(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::GetTopicRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::GetTopicResponse>,
|
||||
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(
|
||||
"/norun.v1.RegistryService/GetTopic",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(GrpcMethod::new("norun.v1.RegistryService", "GetTopic"));
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Generated server implementations.
|
||||
@@ -118,11 +146,21 @@ pub mod registry_service_server {
|
||||
/// Generated trait containing gRPC methods that should be implemented for use with RegistryServiceServer.
|
||||
#[async_trait]
|
||||
pub trait RegistryService: Send + Sync + 'static {
|
||||
///
|
||||
async fn publish(
|
||||
&self,
|
||||
request: tonic::Request<super::PublishRequest>,
|
||||
) -> std::result::Result<tonic::Response<super::PublishResponse>, tonic::Status>;
|
||||
///
|
||||
async fn get_topic(
|
||||
&self,
|
||||
request: tonic::Request<super::GetTopicRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::GetTopicResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
}
|
||||
///
|
||||
#[derive(Debug)]
|
||||
pub struct RegistryServiceServer<T: RegistryService> {
|
||||
inner: _Inner<T>,
|
||||
@@ -248,6 +286,52 @@ pub mod registry_service_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/norun.v1.RegistryService/GetTopic" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct GetTopicSvc<T: RegistryService>(pub Arc<T>);
|
||||
impl<
|
||||
T: RegistryService,
|
||||
> tonic::server::UnaryService<super::GetTopicRequest>
|
||||
for GetTopicSvc<T> {
|
||||
type Response = super::GetTopicResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::GetTopicRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as RegistryService>::get_topic(&inner, request).await
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
}
|
||||
let accept_compression_encodings = self.accept_compression_encodings;
|
||||
let send_compression_encodings = self.send_compression_encodings;
|
||||
let max_decoding_message_size = self.max_decoding_message_size;
|
||||
let max_encoding_message_size = self.max_encoding_message_size;
|
||||
let inner = self.inner.clone();
|
||||
let fut = async move {
|
||||
let inner = inner.0;
|
||||
let method = GetTopicSvc(inner);
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let mut grpc = tonic::server::Grpc::new(codec)
|
||||
.apply_compression_config(
|
||||
accept_compression_encodings,
|
||||
send_compression_encodings,
|
||||
)
|
||||
.apply_max_message_size_config(
|
||||
max_decoding_message_size,
|
||||
max_encoding_message_size,
|
||||
);
|
||||
let res = grpc.unary(method, req).await;
|
||||
Ok(res)
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
_ => {
|
||||
Box::pin(async move {
|
||||
Ok(
|
||||
|
Reference in New Issue
Block a user