From 088309979403073de9992e084b8e41a442548cc5 Mon Sep 17 00:00:00 2001 From: Millione Date: Tue, 3 Sep 2024 20:28:50 +0800 Subject: [PATCH] rename --- volo-thrift/src/transport/incoming.rs | 6 ------ volo-thrift/src/transport/multiplex/client.rs | 2 +- volo-thrift/src/transport/pingpong/client.rs | 2 +- volo-thrift/src/transport/pingpong/server.rs | 2 +- .../src/transport/pool/make_transport.rs | 2 +- volo-thrift/src/transport/pool/mod.rs | 20 +++++++++---------- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/volo-thrift/src/transport/incoming.rs b/volo-thrift/src/transport/incoming.rs index 5a03246f..7a6d3e51 100644 --- a/volo-thrift/src/transport/incoming.rs +++ b/volo-thrift/src/transport/incoming.rs @@ -30,9 +30,3 @@ impl Stream for Incoming { } } } - -#[cfg(test)] -mod tests { - #[test] - fn test() {} -} diff --git a/volo-thrift/src/transport/multiplex/client.rs b/volo-thrift/src/transport/multiplex/client.rs index b949e55e..1fe3a02e 100644 --- a/volo-thrift/src/transport/multiplex/client.rs +++ b/volo-thrift/src/transport/multiplex/client.rs @@ -157,7 +157,7 @@ where } } if cx.transport.should_reuse && resp.is_ok() { - if let Transport::Pooled(pooled) = transport { + if let Transport::TcpOrUnix(pooled) = transport { pooled.reuse().await; } } diff --git a/volo-thrift/src/transport/pingpong/client.rs b/volo-thrift/src/transport/pingpong/client.rs index 78758fb7..b97b4bb7 100644 --- a/volo-thrift/src/transport/pingpong/client.rs +++ b/volo-thrift/src/transport/pingpong/client.rs @@ -131,7 +131,7 @@ where .call((target, shmipc_target.clone(), Ver::PingPong)) .await?; cx.stats.record_make_transport_end_at(); - if let Transport::UnPooled(_) = transport { + if let Transport::Shm(_) = transport { cx.rpc_info .caller_mut() .set_transport(volo::net::shm::Transport(FastStr::new("shmipc"))) diff --git a/volo-thrift/src/transport/pingpong/server.rs b/volo-thrift/src/transport/pingpong/server.rs index ad8e8fc1..f75870a3 100644 --- a/volo-thrift/src/transport/pingpong/server.rs +++ b/volo-thrift/src/transport/pingpong/server.rs @@ -60,7 +60,7 @@ pub async fn serve( cx.rpc_info.caller_mut().set_address(peer_addr.clone()); } else { cx.rpc_info - .caller_mut() + .callee_mut() .set_transport(volo::net::shm::Transport(FastStr::new("shmipc"))); cx.rpc_info .caller_mut() diff --git a/volo-thrift/src/transport/pool/make_transport.rs b/volo-thrift/src/transport/pool/make_transport.rs index d9fa1c09..9393eeac 100644 --- a/volo-thrift/src/transport/pool/make_transport.rs +++ b/volo-thrift/src/transport/pool/make_transport.rs @@ -56,7 +56,7 @@ where let mt = self.inner.clone(); if let Some(addr) = kv.1 { if let Ok(resp) = mt.call(addr.clone()).await { - return Ok(Transport::UnPooled(resp)); + return Ok(Transport::Shm(resp)); } } self.pool diff --git a/volo-thrift/src/transport/pool/mod.rs b/volo-thrift/src/transport/pool/mod.rs index ee6af47b..9334a8d7 100644 --- a/volo-thrift/src/transport/pool/mod.rs +++ b/volo-thrift/src/transport/pool/mod.rs @@ -416,17 +416,17 @@ struct Idle { } pub enum Transport { - Pooled(Pooled), - UnPooled(T), + TcpOrUnix(Pooled), + Shm(T), } impl Transport> { pub async fn reuse(self) { match self { - Transport::Pooled(pooled) => { + Transport::TcpOrUnix(pooled) => { pooled.reuse().await; } - Transport::UnPooled(t) => { + Transport::Shm(t) => { t.reuse().await; } } @@ -435,21 +435,21 @@ impl Transport> { impl From> for Transport { fn from(pooled: Pooled) -> Self { - Transport::Pooled(pooled) + Transport::TcpOrUnix(pooled) } } impl From for Transport { fn from(t: T) -> Self { - Transport::UnPooled(t) + Transport::Shm(t) } } impl AsRef for Transport { fn as_ref(&self) -> &T { match self { - Transport::Pooled(pooled) => pooled.t.as_ref().expect("not dropped"), - Transport::UnPooled(t) => t, + Transport::TcpOrUnix(pooled) => pooled.t.as_ref().expect("not dropped"), + Transport::Shm(t) => t, } } } @@ -457,8 +457,8 @@ impl AsRef for Transport { impl AsMut for Transport { fn as_mut(&mut self) -> &mut T { match self { - Transport::Pooled(pooled) => pooled.t.as_mut().expect("not dropped"), - Transport::UnPooled(t) => t, + Transport::TcpOrUnix(pooled) => pooled.t.as_mut().expect("not dropped"), + Transport::Shm(t) => t, } } }