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

Feature/rpc alignment #21

Merged

Conversation

MelamudMichael
Copy link
Contributor

@MelamudMichael MelamudMichael commented Mar 17, 2024

  1. Using uattributes from protobuf
  2. Aligning invokeMethod to up-core 1.5.7
  3. Added invokeMethod with Cb
  4. Added unit-tests for RPC client

Remove the init/term functions in favor of using the constructor and
destructor for the sub classes, and use a shared_ptr to do the reference
counting.

Signed-off-by: Bill Pittman <william.1.pittman@gm.com>
Signed-off-by: Bill Pittman <william.1.pittman@gm.com>
Comment on lines +94 to +97
uprotocol::v1::UStatus invokeMethod(const uprotocol::v1::UUri &topic,
const uprotocol::utransport::UPayload &payload,
const uprotocol::v1::CallOptions &options,
const uprotocol::utransport::UListener &callback) noexcept;
Copy link
Contributor

Choose a reason for hiding this comment

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

This would need to be updated if UListener is changed to replace functors with lambdas. See my comment on the up-cpp PR

Copy link
Contributor Author

@MelamudMichael MelamudMichael Apr 4, 2024

Choose a reason for hiding this comment

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

Not going to be handled part of this release

Choose a reason for hiding this comment

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

@MelamudMichael if something is not going to be resolved, add a link to the issue that will be used to track the change.

lib/src/zenohRpcClient.cpp Outdated Show resolved Hide resolved
lib/src/zenohRpcClient.cpp Outdated Show resolved Hide resolved
return handle;
} else {
return nullptr;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@billpittman add print


handle = std::make_shared<upZenohClient>(ConstructToken());
if (handle->rpcSuccess_.code() == UCode::OK && handle->uSuccess_.code() == UCode::OK) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@billpittman please rename uSucess to uTransportSuccess

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@billpittman please add brackets around each condition

UStatus status;
if (UCode::OK != ZenohSessionManager::instance().init(config)) {
spdlog::error("zenohSessionManager::instance().init() failed");
rpcSuccess_.set_code(UCode::UNAVAILABLE);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@billpittman instead of setting the code in each failure, set it to failure by default in the beginning of the function

}
ZenohRpcClient::~ZenohRpcClient() noexcept {
if (UCode::OK != ZenohSessionManager::instance().term()) {
spdlog::error("zenohSessionManager::instance().term() failed");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@billpittman do return in case of failure

lib/src/zenohRpcClient.cpp Outdated Show resolved Hide resolved

if (0 == refCount_) {
spdlog::error("ZenohRpcClient is not initialized");
return future;
}

if (false == isRPCMethod(uri.resource())) {
if (false == isRPCMethod(topic.resource())) {
spdlog::error("URI is not of RPC type");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

* get queue size
* @return queue size
*/
size_t getQueueSize() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

* get the number of max concurrent request
* @return number of concurrent requests
*/
size_t getMaxConcurrentRequests() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link

@stevenhartley stevenhartley left a comment

Choose a reason for hiding this comment

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

Please see comments

Comment on lines +94 to +97
uprotocol::v1::UStatus invokeMethod(const uprotocol::v1::UUri &topic,
const uprotocol::utransport::UPayload &payload,
const uprotocol::v1::CallOptions &options,
const uprotocol::utransport::UListener &callback) noexcept;

Choose a reason for hiding this comment

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

@MelamudMichael if something is not going to be resolved, add a link to the issue that will be used to track the change.

* get the number of max concurrent request
* @return number of concurrent requests
*/
size_t getMaxConcurrentRequests() {

Choose a reason for hiding this comment

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

@MelamudMichael, could we not just fail if the max concurrent requests fail? I'm worried this is adding complexity to the app developer that they do not need.

* get queue size
* @return queue size
*/
size_t getQueueSize() {

Choose a reason for hiding this comment

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

@MelamudMichael if you expose this logic to the app developer, they need to maintain a list/queue of requests as well, I don't think we should do this.

Copy link

@stevenhartley stevenhartley left a comment

Choose a reason for hiding this comment

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

Merging for now, open items will be addressed later.

@stevenhartley stevenhartley merged commit 8c03c2a into eclipse-uprotocol:main Apr 9, 2024
3 checks passed
@gregmedd gregmedd mentioned this pull request Apr 10, 2024
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.

7 participants