feat: added v1 files

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-08-12 00:36:17 +02:00
parent 8c1f7f829d
commit fcaf77b777
Signed by: kjuulh
GPG Key ID: D85D7535F18F35FA
7 changed files with 59 additions and 357 deletions

View File

@ -39,5 +39,5 @@ pub struct GetKeysResponse {
#[prost(string, repeated, tag="1")] #[prost(string, repeated, tag="1")]
pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
} }
include!("nodata.tonic.rs"); include!("nodata.v1.tonic.rs");
// @@protoc_insertion_point(module) // @@protoc_insertion_point(module)

View File

@ -1,14 +1,14 @@
// @generated // @generated
/// Generated client implementations. /// Generated client implementations.
pub mod no_data_client { pub mod no_data_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*; use tonic::codegen::*;
use tonic::codegen::http::Uri; use tonic::codegen::http::Uri;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct NoDataClient<T> { pub struct NoDataServiceClient<T> {
inner: tonic::client::Grpc<T>, inner: tonic::client::Grpc<T>,
} }
impl NoDataClient<tonic::transport::Channel> { impl NoDataServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint. /// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error> pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where where
@ -19,7 +19,7 @@ pub mod no_data_client {
Ok(Self::new(conn)) Ok(Self::new(conn))
} }
} }
impl<T> NoDataClient<T> impl<T> NoDataServiceClient<T>
where where
T: tonic::client::GrpcService<tonic::body::BoxBody>, T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>, T::Error: Into<StdError>,
@ -37,7 +37,7 @@ pub mod no_data_client {
pub fn with_interceptor<F>( pub fn with_interceptor<F>(
inner: T, inner: T,
interceptor: F, interceptor: F,
) -> NoDataClient<InterceptedService<T, F>> ) -> NoDataServiceClient<InterceptedService<T, F>>
where where
F: tonic::service::Interceptor, F: tonic::service::Interceptor,
T::ResponseBody: Default, T::ResponseBody: Default,
@ -51,7 +51,7 @@ pub mod no_data_client {
http::Request<tonic::body::BoxBody>, http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync, >>::Error: Into<StdError> + Send + Sync,
{ {
NoDataClient::new(InterceptedService::new(inner, interceptor)) NoDataServiceClient::new(InterceptedService::new(inner, interceptor))
} }
/// Compress requests with the given encoding. /// Compress requests with the given encoding.
/// ///
@ -102,11 +102,11 @@ pub mod no_data_client {
})?; })?;
let codec = tonic::codec::ProstCodec::default(); let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static( let path = http::uri::PathAndQuery::from_static(
"/nodata.NoData/PublishEvent", "/nodata.v1.NoDataService/PublishEvent",
); );
let mut req = request.into_request(); let mut req = request.into_request();
req.extensions_mut() req.extensions_mut()
.insert(GrpcMethod::new("nodata.NoData", "PublishEvent")); .insert(GrpcMethod::new("nodata.v1.NoDataService", "PublishEvent"));
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
pub async fn get_topics( pub async fn get_topics(
@ -126,9 +126,12 @@ pub mod no_data_client {
) )
})?; })?;
let codec = tonic::codec::ProstCodec::default(); let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/nodata.NoData/GetTopics"); let path = http::uri::PathAndQuery::from_static(
"/nodata.v1.NoDataService/GetTopics",
);
let mut req = request.into_request(); let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("nodata.NoData", "GetTopics")); req.extensions_mut()
.insert(GrpcMethod::new("nodata.v1.NoDataService", "GetTopics"));
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
pub async fn get_keys( pub async fn get_keys(
@ -148,20 +151,23 @@ pub mod no_data_client {
) )
})?; })?;
let codec = tonic::codec::ProstCodec::default(); let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/nodata.NoData/GetKeys"); let path = http::uri::PathAndQuery::from_static(
"/nodata.v1.NoDataService/GetKeys",
);
let mut req = request.into_request(); let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("nodata.NoData", "GetKeys")); req.extensions_mut()
.insert(GrpcMethod::new("nodata.v1.NoDataService", "GetKeys"));
self.inner.unary(req, path, codec).await self.inner.unary(req, path, codec).await
} }
} }
} }
/// Generated server implementations. /// Generated server implementations.
pub mod no_data_server { pub mod no_data_service_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*; use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with NoDataServer. /// Generated trait containing gRPC methods that should be implemented for use with NoDataServiceServer.
#[async_trait] #[async_trait]
pub trait NoData: Send + Sync + 'static { pub trait NoDataService: Send + Sync + 'static {
async fn publish_event( async fn publish_event(
&self, &self,
request: tonic::Request<super::PublishEventRequest>, request: tonic::Request<super::PublishEventRequest>,
@ -182,7 +188,7 @@ pub mod no_data_server {
) -> std::result::Result<tonic::Response<super::GetKeysResponse>, tonic::Status>; ) -> std::result::Result<tonic::Response<super::GetKeysResponse>, tonic::Status>;
} }
#[derive(Debug)] #[derive(Debug)]
pub struct NoDataServer<T: NoData> { pub struct NoDataServiceServer<T: NoDataService> {
inner: _Inner<T>, inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings, accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings,
@ -190,7 +196,7 @@ pub mod no_data_server {
max_encoding_message_size: Option<usize>, max_encoding_message_size: Option<usize>,
} }
struct _Inner<T>(Arc<T>); struct _Inner<T>(Arc<T>);
impl<T: NoData> NoDataServer<T> { impl<T: NoDataService> NoDataServiceServer<T> {
pub fn new(inner: T) -> Self { pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner)) Self::from_arc(Arc::new(inner))
} }
@ -242,9 +248,9 @@ pub mod no_data_server {
self self
} }
} }
impl<T, B> tonic::codegen::Service<http::Request<B>> for NoDataServer<T> impl<T, B> tonic::codegen::Service<http::Request<B>> for NoDataServiceServer<T>
where where
T: NoData, T: NoDataService,
B: Body + Send + 'static, B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static, B::Error: Into<StdError> + Send + 'static,
{ {
@ -260,11 +266,11 @@ pub mod no_data_server {
fn call(&mut self, req: http::Request<B>) -> Self::Future { fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone(); let inner = self.inner.clone();
match req.uri().path() { match req.uri().path() {
"/nodata.NoData/PublishEvent" => { "/nodata.v1.NoDataService/PublishEvent" => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
struct PublishEventSvc<T: NoData>(pub Arc<T>); struct PublishEventSvc<T: NoDataService>(pub Arc<T>);
impl< impl<
T: NoData, T: NoDataService,
> tonic::server::UnaryService<super::PublishEventRequest> > tonic::server::UnaryService<super::PublishEventRequest>
for PublishEventSvc<T> { for PublishEventSvc<T> {
type Response = super::PublishEventResponse; type Response = super::PublishEventResponse;
@ -278,7 +284,7 @@ pub mod no_data_server {
) -> Self::Future { ) -> Self::Future {
let inner = Arc::clone(&self.0); let inner = Arc::clone(&self.0);
let fut = async move { let fut = async move {
<T as NoData>::publish_event(&inner, request).await <T as NoDataService>::publish_event(&inner, request).await
}; };
Box::pin(fut) Box::pin(fut)
} }
@ -306,10 +312,12 @@ pub mod no_data_server {
}; };
Box::pin(fut) Box::pin(fut)
} }
"/nodata.NoData/GetTopics" => { "/nodata.v1.NoDataService/GetTopics" => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
struct GetTopicsSvc<T: NoData>(pub Arc<T>); struct GetTopicsSvc<T: NoDataService>(pub Arc<T>);
impl<T: NoData> tonic::server::UnaryService<super::GetTopicsRequest> impl<
T: NoDataService,
> tonic::server::UnaryService<super::GetTopicsRequest>
for GetTopicsSvc<T> { for GetTopicsSvc<T> {
type Response = super::GetTopicsResponse; type Response = super::GetTopicsResponse;
type Future = BoxFuture< type Future = BoxFuture<
@ -322,7 +330,7 @@ pub mod no_data_server {
) -> Self::Future { ) -> Self::Future {
let inner = Arc::clone(&self.0); let inner = Arc::clone(&self.0);
let fut = async move { let fut = async move {
<T as NoData>::get_topics(&inner, request).await <T as NoDataService>::get_topics(&inner, request).await
}; };
Box::pin(fut) Box::pin(fut)
} }
@ -350,10 +358,12 @@ pub mod no_data_server {
}; };
Box::pin(fut) Box::pin(fut)
} }
"/nodata.NoData/GetKeys" => { "/nodata.v1.NoDataService/GetKeys" => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
struct GetKeysSvc<T: NoData>(pub Arc<T>); struct GetKeysSvc<T: NoDataService>(pub Arc<T>);
impl<T: NoData> tonic::server::UnaryService<super::GetKeysRequest> impl<
T: NoDataService,
> tonic::server::UnaryService<super::GetKeysRequest>
for GetKeysSvc<T> { for GetKeysSvc<T> {
type Response = super::GetKeysResponse; type Response = super::GetKeysResponse;
type Future = BoxFuture< type Future = BoxFuture<
@ -366,7 +376,7 @@ pub mod no_data_server {
) -> Self::Future { ) -> Self::Future {
let inner = Arc::clone(&self.0); let inner = Arc::clone(&self.0);
let fut = async move { let fut = async move {
<T as NoData>::get_keys(&inner, request).await <T as NoDataService>::get_keys(&inner, request).await
}; };
Box::pin(fut) Box::pin(fut)
} }
@ -409,7 +419,7 @@ pub mod no_data_server {
} }
} }
} }
impl<T: NoData> Clone for NoDataServer<T> { impl<T: NoDataService> Clone for NoDataServiceServer<T> {
fn clone(&self) -> Self { fn clone(&self) -> Self {
let inner = self.inner.clone(); let inner = self.inner.clone();
Self { Self {
@ -421,7 +431,7 @@ pub mod no_data_server {
} }
} }
} }
impl<T: NoData> Clone for _Inner<T> { impl<T: NoDataService> Clone for _Inner<T> {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self(Arc::clone(&self.0)) Self(Arc::clone(&self.0))
} }
@ -431,7 +441,7 @@ pub mod no_data_server {
write!(f, "{:?}", self.0) write!(f, "{:?}", self.0)
} }
} }
impl<T: NoData> tonic::server::NamedService for NoDataServer<T> { impl<T: NoDataService> tonic::server::NamedService for NoDataServiceServer<T> {
const NAME: &'static str = "nodata.NoData"; const NAME: &'static str = "nodata.v1.NoDataService";
} }
} }

View File

@ -1,19 +0,0 @@
// @generated
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PublishEventRequest {
#[prost(string, tag="1")]
pub topic: ::prost::alloc::string::String,
#[prost(message, optional, tag="2")]
pub published: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag="3")]
pub key: ::prost::alloc::string::String,
#[prost(bytes="vec", tag="4")]
pub value: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PublishEventResponse {
}
include!("nomicon.tonic.rs");
// @@protoc_insertion_point(module)

View File

@ -1,294 +0,0 @@
// @generated
/// Generated client implementations.
pub mod no_data_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 NoDataClient<T> {
inner: tonic::client::Grpc<T>,
}
impl NoDataClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> NoDataClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> NoDataClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
NoDataClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn publish_event(
&mut self,
request: impl tonic::IntoRequest<super::PublishEventRequest>,
) -> std::result::Result<
tonic::Response<super::PublishEventResponse>,
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(
"/nomicon.NoData/PublishEvent",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("nomicon.NoData", "PublishEvent"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod no_data_server {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with NoDataServer.
#[async_trait]
pub trait NoData: Send + Sync + 'static {
async fn publish_event(
&self,
request: tonic::Request<super::PublishEventRequest>,
) -> std::result::Result<
tonic::Response<super::PublishEventResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct NoDataServer<T: NoData> {
inner: _Inner<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
struct _Inner<T>(Arc<T>);
impl<T: NoData> NoDataServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for NoDataServer<T>
where
T: NoData,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/nomicon.NoData/PublishEvent" => {
#[allow(non_camel_case_types)]
struct PublishEventSvc<T: NoData>(pub Arc<T>);
impl<
T: NoData,
> tonic::server::UnaryService<super::PublishEventRequest>
for PublishEventSvc<T> {
type Response = super::PublishEventResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PublishEventRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as NoData>::publish_event(&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 = PublishEventSvc(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(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
impl<T: NoData> Clone for NoDataServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
impl<T: NoData> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(Arc::clone(&self.0))
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: NoData> tonic::server::NamedService for NoDataServer<T> {
const NAME: &'static str = "nomicon.NoData";
}
}

View File

@ -8,7 +8,7 @@ use crate::{
state::SharedState, state::SharedState,
}; };
include!("gen/nodata.rs"); include!("gen/nodata.v1.rs");
#[derive(Clone)] #[derive(Clone)]
pub struct GrpcServer { pub struct GrpcServer {
@ -26,7 +26,7 @@ impl GrpcServer {
} }
#[tonic::async_trait] #[tonic::async_trait]
impl no_data_server::NoData for GrpcServer { impl no_data_service_server::NoDataService for GrpcServer {
async fn publish_event( async fn publish_event(
&self, &self,
request: tonic::Request<PublishEventRequest>, request: tonic::Request<PublishEventRequest>,
@ -99,7 +99,9 @@ impl Component for GrpcServer {
tracing::info!("grpc listening on: {}", self.host); tracing::info!("grpc listening on: {}", self.host);
tonic::transport::Server::builder() tonic::transport::Server::builder()
.add_service(no_data_server::NoDataServer::new(self.clone())) .add_service(no_data_service_server::NoDataServiceServer::new(
self.clone(),
))
.serve(self.host) .serve(self.host)
.await .await
.context("grpc server failed") .context("grpc server failed")

View File

@ -7,7 +7,7 @@ mod services;
use std::net::SocketAddr; use std::net::SocketAddr;
use chrono::{Datelike, Timelike}; use chrono::{Datelike, Timelike};
use clap::{Parser, Subcommand, ValueEnum}; use clap::{Parser, Subcommand};
use grpc::{GetKeysRequest, GetTopicsRequest, GrpcServer, PublishEventRequest}; use grpc::{GetKeysRequest, GetTopicsRequest, GrpcServer, PublishEventRequest};
use http::HttpServer; use http::HttpServer;
use mad::Mad; use mad::Mad;
@ -154,8 +154,11 @@ async fn main() -> anyhow::Result<()> {
async fn create_client( async fn create_client(
grpc_host: String, grpc_host: String,
) -> anyhow::Result<crate::grpc::no_data_client::NoDataClient<tonic::transport::Channel>> { ) -> anyhow::Result<
let client = crate::grpc::no_data_client::NoDataClient::connect(grpc_host).await?; crate::grpc::no_data_service_client::NoDataServiceClient<tonic::transport::Channel>,
> {
let client =
crate::grpc::no_data_service_client::NoDataServiceClient::connect(grpc_host).await?;
Ok(client) Ok(client)
} }

View File

@ -2,9 +2,9 @@ syntax = "proto3";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
package nodata; package nodata.v1;
service NoData { service NoDataService {
rpc PublishEvent(PublishEventRequest) returns (PublishEventResponse) {} rpc PublishEvent(PublishEventRequest) returns (PublishEventResponse) {}
rpc GetTopics(GetTopicsRequest) returns (GetTopicsResponse) {} rpc GetTopics(GetTopicsRequest) returns (GetTopicsResponse) {}
rpc GetKeys(GetKeysRequest) returns (GetKeysResponse) {} rpc GetKeys(GetKeysRequest) returns (GetKeysResponse) {}