Add rpc_client interface.#11154
Conversation
| std::atomic<int64_t> req_count_{0}; | ||
| std::mutex mutex_; | ||
| static std::unique_ptr<RPCClient> rpc_client_; | ||
| static std::unique_ptr<GRPCClient> rpc_client_; |
There was a problem hiding this comment.
rpc_client_
=>
grpc_client_
|
|
||
| virtual bool Wait() = 0; | ||
|
|
||
| static const int64_t rpc_time_out = 600 * 1000; |
|
|
||
| class RPCClient { | ||
| public: | ||
| virtual bool AsyncSendVariable(const std::string& ep, |
There was a problem hiding this comment.
We can make it shorter like ASendVar, SendVar, AGetVar, GetVar etc.
There was a problem hiding this comment.
Async不建议简写。 改成了类似AsyncSendVar。
| platform::RecordEvent record_event(Type(), &ctx); | ||
|
|
||
| auto rpc_client = detail::RPCClient::GetInstance(); | ||
| auto rpc_client = detail::GRPCClient::GetInstance(); |
There was a problem hiding this comment.
To use the client, better to use the type of base class, since we use a singleton, you can make the base class RPCClient as a singleton, and other clients can inherit from it.
typhoonzero
left a comment
There was a problem hiding this comment.
LGTM, just two tiny comments.
|
|
||
| virtual void Wait() = 0; | ||
|
|
||
| static constexpr int64_t rpc_time_out = 600 * 1000; |
| } | ||
|
|
||
| protected: | ||
| virtual void InitImpl() = 0; |
There was a problem hiding this comment.
This may not need to be pure virtual, not all implementations need to start an event loop for a client.
typhoonzero
left a comment
There was a problem hiding this comment.
LGTM++, can you pls add some comments about the RPC client interface?
|
Will do in next PR. |
Fix part of #10804
The old PR is #10805