chore(examples): Remove dummy echo implementation (#1178)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
pub mod pb {
|
||||
tonic::include_proto!("/grpc.examples.echo");
|
||||
tonic::include_proto!("/grpc.examples.unaryecho");
|
||||
}
|
||||
|
||||
use pb::{echo_client::EchoClient, EchoRequest};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! provide a custom `ClientConfig` for the tls configuration.
|
||||
|
||||
pub mod pb {
|
||||
tonic::include_proto!("/grpc.examples.echo");
|
||||
tonic::include_proto!("/grpc.examples.unaryecho");
|
||||
}
|
||||
|
||||
use hyper::{client::HttpConnector, Uri};
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
pub mod pb {
|
||||
tonic::include_proto!("/grpc.examples.echo");
|
||||
tonic::include_proto!("/grpc.examples.unaryecho");
|
||||
}
|
||||
|
||||
use futures::Stream;
|
||||
use pb::{EchoRequest, EchoResponse};
|
||||
use std::pin::Pin;
|
||||
use tonic::{
|
||||
transport::{
|
||||
server::{TcpConnectInfo, TlsConnectInfo},
|
||||
Identity, Server, ServerTlsConfig,
|
||||
},
|
||||
Request, Response, Status, Streaming,
|
||||
Request, Response, Status,
|
||||
};
|
||||
|
||||
type EchoResult<T> = Result<Response<T>, Status>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send>>;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct EchoServer;
|
||||
@@ -35,31 +32,6 @@ impl pb::echo_server::Echo for EchoServer {
|
||||
let message = request.into_inner().message;
|
||||
Ok(Response::new(EchoResponse { message }))
|
||||
}
|
||||
|
||||
type ServerStreamingEchoStream = ResponseStream;
|
||||
|
||||
async fn server_streaming_echo(
|
||||
&self,
|
||||
_: Request<EchoRequest>,
|
||||
) -> EchoResult<Self::ServerStreamingEchoStream> {
|
||||
Err(Status::unimplemented("not implemented"))
|
||||
}
|
||||
|
||||
async fn client_streaming_echo(
|
||||
&self,
|
||||
_: Request<Streaming<EchoRequest>>,
|
||||
) -> EchoResult<EchoResponse> {
|
||||
Err(Status::unimplemented("not implemented"))
|
||||
}
|
||||
|
||||
type BidirectionalStreamingEchoStream = ResponseStream;
|
||||
|
||||
async fn bidirectional_streaming_echo(
|
||||
&self,
|
||||
_: Request<Streaming<EchoRequest>>,
|
||||
) -> EchoResult<Self::BidirectionalStreamingEchoStream> {
|
||||
Err(Status::unimplemented("not implemented"))
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
pub mod pb {
|
||||
tonic::include_proto!("/grpc.examples.echo");
|
||||
tonic::include_proto!("/grpc.examples.unaryecho");
|
||||
}
|
||||
|
||||
use futures::Stream;
|
||||
use hyper::server::conn::Http;
|
||||
use pb::{EchoRequest, EchoResponse};
|
||||
use std::{pin::Pin, sync::Arc};
|
||||
use std::sync::Arc;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio_rustls::{
|
||||
rustls::{Certificate, PrivateKey, ServerConfig},
|
||||
TlsAcceptor,
|
||||
};
|
||||
use tonic::{transport::Server, Request, Response, Status, Streaming};
|
||||
use tonic::{transport::Server, Request, Response, Status};
|
||||
use tower_http::ServiceBuilderExt;
|
||||
|
||||
#[tokio::main]
|
||||
@@ -98,7 +97,6 @@ struct ConnInfo {
|
||||
}
|
||||
|
||||
type EchoResult<T> = Result<Response<T>, Status>;
|
||||
type ResponseStream = Pin<Box<dyn Stream<Item = Result<EchoResponse, Status>> + Send>>;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct EchoServer;
|
||||
@@ -115,29 +113,4 @@ impl pb::echo_server::Echo for EchoServer {
|
||||
let message = request.into_inner().message;
|
||||
Ok(Response::new(EchoResponse { message }))
|
||||
}
|
||||
|
||||
type ServerStreamingEchoStream = ResponseStream;
|
||||
|
||||
async fn server_streaming_echo(
|
||||
&self,
|
||||
_: Request<EchoRequest>,
|
||||
) -> EchoResult<Self::ServerStreamingEchoStream> {
|
||||
Err(Status::unimplemented("not implemented"))
|
||||
}
|
||||
|
||||
async fn client_streaming_echo(
|
||||
&self,
|
||||
_: Request<Streaming<EchoRequest>>,
|
||||
) -> EchoResult<EchoResponse> {
|
||||
Err(Status::unimplemented("not implemented"))
|
||||
}
|
||||
|
||||
type BidirectionalStreamingEchoStream = ResponseStream;
|
||||
|
||||
async fn bidirectional_streaming_echo(
|
||||
&self,
|
||||
_: Request<Streaming<EchoRequest>>,
|
||||
) -> EchoResult<Self::BidirectionalStreamingEchoStream> {
|
||||
Err(Status::unimplemented("not implemented"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user