From 1005cde2989618acd8c5a7c87ca0e088142c83e9 Mon Sep 17 00:00:00 2001 From: Georgy Moshkin <gmoshkin@picodata.io> Date: Fri, 28 Jul 2023 16:23:57 +0300 Subject: [PATCH] rename: trait rpc::Request -> rpc::RequestArgs --- src/rpc/mod.rs | 8 ++++---- src/sync.rs | 6 +++--- src/traft/network.rs | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/rpc/mod.rs b/src/rpc/mod.rs index 22cdb12ecb..a8a3f19c18 100644 --- a/src/rpc/mod.rs +++ b/src/rpc/mod.rs @@ -22,7 +22,7 @@ pub mod update_instance; /// Types implementing this trait represent an RPC's (remote procedure call) /// arguments. This trait contains information about the request. -pub trait Request: Encode + DecodeOwned { +pub trait RequestArgs: Encode + DecodeOwned { /// Remote procedure name. const PROC_NAME: &'static str; @@ -33,7 +33,7 @@ pub trait Request: Encode + DecodeOwned { /// Invoke remote procedure call on an instance specified by `address`. pub async fn network_call<R>(address: &str, request: &R) -> ::tarantool::Result<R::Response> where - R: Request, + R: RequestArgs, { // TODO: move address parsing into client let (address, port) = address.rsplit_once(':').ok_or_else(|| { @@ -53,7 +53,7 @@ where /// Invoke remote procedure call on a Raft leader. pub async fn network_call_to_leader<R>(request: &R) -> Result<R::Response> where - R: Request, + R: RequestArgs, { let node = node::global()?; let leader_id = node.status().leader_id.ok_or(Error::LeaderUnknown)?; @@ -100,7 +100,7 @@ macro_rules! define_rpc_request { $({ $($res_named_fields)* })? $(( $($res_unnamed_fields)* );)? - impl $crate::rpc::Request for $request { + impl $crate::rpc::RequestArgs for $request { const PROC_NAME: &'static str = $crate::stringify_cfunc!($proc); type Response = $response; } diff --git a/src/sync.rs b/src/sync.rs index 6c5d8c08bf..f2d4ec1f99 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -52,7 +52,7 @@ pub struct WaitVclockRpc { impl Encode for WaitVclockRpc {} -impl rpc::Request for WaitVclockRpc { +impl rpc::RequestArgs for WaitVclockRpc { const PROC_NAME: &'static str = crate::stringify_cfunc!(proc_wait_vclock); type Response = (Vclock,); } @@ -125,7 +125,7 @@ pub struct ReadIndexRpc { impl Encode for ReadIndexRpc {} -impl rpc::Request for ReadIndexRpc { +impl rpc::RequestArgs for ReadIndexRpc { const PROC_NAME: &'static str = crate::stringify_cfunc!(proc_read_index); type Response = (RaftIndex,); } @@ -152,7 +152,7 @@ pub struct WaitIndexRpc { impl Encode for WaitIndexRpc {} -impl rpc::Request for WaitIndexRpc { +impl rpc::RequestArgs for WaitIndexRpc { const PROC_NAME: &'static str = crate::stringify_cfunc!(proc_wait_index); type Response = (RaftIndex,); } diff --git a/src/traft/network.rs b/src/traft/network.rs index 8e00fa3f4e..5217e8ccd8 100644 --- a/src/traft/network.rs +++ b/src/traft/network.rs @@ -238,7 +238,7 @@ impl PoolWorker { /// - in case peer responded with an error pub fn rpc<R>(&mut self, request: &R, cb: impl FnOnce(Result<R::Response>) + 'static) where - R: rpc::Request, + R: rpc::RequestArgs, { let args = unwrap_ok_or!(request.to_tuple_buffer(), Err(e) => { return cb(Err(e.into())) } @@ -449,7 +449,7 @@ impl ConnectionPool { req: &R, ) -> Result<impl Future<Output = Result<R::Response>>> where - R: rpc::Request, + R: rpc::RequestArgs, { let (tx, mut rx) = oneshot::channel(); id.get_or_create_in(self)?.rpc(req, move |res| { -- GitLab