Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify RpcStyle message routing #1511

Merged
merged 1 commit into from
May 16, 2024
Merged

Unify RpcStyle message routing #1511

merged 1 commit into from
May 16, 2024

Conversation

AhmedSoliman
Copy link
Contributor

@AhmedSoliman AhmedSoliman commented May 14, 2024

Unify RpcStyle message routing

Introduces types that makes it easier to perform Rpc-like interactions with Networking.

  • RpcMessage trait marks messages that carry a CorrelationId. A sane default correlation id is provided as RequestId.
  • RpcRequest trait defines request messages and their response types.
  • RpcRouter<T: RpcRequest> enables sending rpc request and awaiting responses with auto eviction of dropped requests.
  • ResponseTracker is a helper that manages tracking tokens for in-flight requests, this can be used in the future to replace large portions of IngressDispatcher.
  • Macros to help define RPC messages to reduce code noise in node-protocol

Stack created with Sapling. Best reviewed with ReviewStack.

Copy link

github-actions bot commented May 14, 2024

Test Results

 99 files  ±0   99 suites  ±0   8m 34s ⏱️ +6s
 84 tests ±0   82 ✅ ±0  2 💤 ±0  0 ❌ ±0 
216 runs  ±0  210 ✅ ±0  6 💤 ±0  0 ❌ ±0 

Results for commit 157fc63. ± Comparison against base commit a7e81b0.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @AhmedSoliman. The RpcRouter looks like a cool abstraction. The changes look good to me :-) +1 for merging.

crates/network/src/rpc_router.rs Show resolved Hide resolved
crates/network/src/rpc_router.rs Show resolved Hide resolved
crates/network/src/rpc_router.rs Outdated Show resolved Hide resolved
&self,
msg: restate_node_protocol::MessageEnvelope<Self::MessageType>,
) -> impl std::future::Future<Output = ()> + Send {
self.handle_message(msg);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log on debug or trace if a message could not be handled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about that one. I suspect that it can be a common place where the tracker token is dropped on timeouts and it would be noisy (and potentially not very useful) log message in this case.

Introduces types that makes it easier to perform Rpc-like interactions with Networking.
- `RpcMessage` trait marks messages that carry a `CorrelationId`. A sane default correlation id is provided as `RequestId`.
- `RpcRequest` trait defines request messages and their response types.
- `RpcRouter<T: RpcRequest>` enables sending rpc request and awaiting responses with auto eviction of dropped requests.
- `ResponseTracker` is a helper that manages tracking tokens for in-flight requests, this can be used in the future to replace large portions of IngressDispatcher.
- Macros to help define RPC messages to reduce code noise in node-protocol
@AhmedSoliman AhmedSoliman merged commit c4abe86 into main May 16, 2024
10 checks passed
@AhmedSoliman AhmedSoliman deleted the pr1511 branch May 16, 2024 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants