-
Notifications
You must be signed in to change notification settings - Fork 497
[TE] Refactor TransferEngine into Impl + forwarding wrapper #1250
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @alogfans, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the TransferEngine class by separating its interface from its implementation using the Pimpl (pointer to implementation) idiom. The implementation details are moved into a new TransferEngineImpl class. This is a great architectural improvement that will help with backward compatibility and reduce compilation dependencies for clients of TransferEngine.
The changes are well-executed. I have a few suggestions to improve const-correctness, header hygiene, and performance. Most notably, the const qualifier was dropped from getLocalTopology, which is a breaking API change that should be reverted. I've also pointed out some unnecessary headers and a place where an extra copy can be avoided.
I am having trouble creating individual review comments. Click here to see my feedback.
mooncake-transfer-engine/include/transfer_engine.h (115)
The const qualifier was removed from this method's signature. The original method was const, and the implementation it forwards to in TransferEngineImpl is also const. Removing const is a breaking change for clients that might be calling this on a const TransferEngine object. Please restore the const qualifier to maintain API compatibility and const-correctness. You will also need to add const to the method's implementation in transfer_engine.cpp.
std::shared_ptr<Topology> getLocalTopology() const;
mooncake-transfer-engine/include/transfer_engine_impl.h (18-21)
These headers appear to be unnecessary in this header file and were likely copied over during refactoring. Please remove them to keep includes minimal. If any of these are needed by transfer_engine_impl.cpp, they should be included there directly, preferably using their C++ standard library versions (e.g., <cstring>, <climits>, <cerrno>).
mooncake-transfer-engine/include/transfer_engine_impl.h (150-151)
The remote_agent parameter is taken by value. While the wrapper in TransferEngine uses std::move, this still results in an extra move construction for the std::string. To improve efficiency, consider taking remote_agent by const std::string&. This avoids the extra move while still allowing efficient handling of rvalues from the caller. Remember to update the implementation in transfer_engine_impl.cpp as well.
int sendNotifyByName(const std::string& remote_agent,
TransferMetadata::NotifyDesc notify_msg);
mooncake-transfer-engine/src/transfer_engine_impl.cpp (20)
The code uses errno, which is defined in <cerrno>. Please explicitly include this header for correctness and portability, as its inclusion via other headers is not guaranteed.
#include <cerrno>
#include <cstring>
Description
Separate interface and implementation of Mooncake TE, therefore TENT has better backward compatibility.
Type of Change
How Has This Been Tested?
Checklist