Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
1005cde2
Commit
1005cde2
authored
1 year ago
by
Georgy Moshkin
Committed by
Yaroslav Dynnikov
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
rename: trait rpc::Request -> rpc::RequestArgs
parent
81799af9
No related branches found
No related tags found
1 merge request
!619
Refactor/network improvements
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/rpc/mod.rs
+4
-4
4 additions, 4 deletions
src/rpc/mod.rs
src/sync.rs
+3
-3
3 additions, 3 deletions
src/sync.rs
src/traft/network.rs
+2
-2
2 additions, 2 deletions
src/traft/network.rs
with
9 additions
and
9 deletions
src/rpc/mod.rs
+
4
−
4
View file @
1005cde2
...
...
@@ -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
Request
Args
:
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
:
Request
Args
,
{
// 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
:
Request
Args
,
{
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
::
Request
Args
for
$request
{
const
PROC_NAME
:
&
'static
str
=
$crate
::
stringify_cfunc!
(
$proc
);
type
Response
=
$response
;
}
...
...
This diff is collapsed.
Click to expand it.
src/sync.rs
+
3
−
3
View file @
1005cde2
...
...
@@ -52,7 +52,7 @@ pub struct WaitVclockRpc {
impl
Encode
for
WaitVclockRpc
{}
impl
rpc
::
Request
for
WaitVclockRpc
{
impl
rpc
::
Request
Args
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
::
Request
Args
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
::
Request
Args
for
WaitIndexRpc
{
const
PROC_NAME
:
&
'static
str
=
crate
::
stringify_cfunc!
(
proc_wait_index
);
type
Response
=
(
RaftIndex
,);
}
...
...
This diff is collapsed.
Click to expand it.
src/traft/network.rs
+
2
−
2
View file @
1005cde2
...
...
@@ -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
::
Request
Args
,
{
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
::
Request
Args
,
{
let
(
tx
,
mut
rx
)
=
oneshot
::
channel
();
id
.get_or_create_in
(
self
)
?
.rpc
(
req
,
move
|
res
|
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment