-
Notifications
You must be signed in to change notification settings - Fork 126
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
Refactor AMQP logic to better isolate rust AMQP code from uAMQP code. #6008
Refactor AMQP logic to better isolate rust AMQP code from uAMQP code. #6008
Conversation
Ping :). |
5cb5d12
to
571d9b5
Compare
Ping please. |
Hi Larry, this is a fairly large PR (I understand a lot of it is refactoring). How would you recommend we review it? Put another way, what areas should we try to focus our attention on, which you think will be the most valuable for you? |
You should ignore the moved files - that's about 250 or so of the files in the PR. Concentrate on the 50 or so remaining files. The vast majority of the changes are removing #if UAMQP conditionals from the UAMQP specific code, and removing UAMQP specific code from the rust implementation. Note that there are some vestiges of the UAMQP stuff in the rust implementations, that's done so I have boilerplate in place to make the rust implementations of stuff that's not there yet. |
f72edbe
to
54da1a8
Compare
fc7f350
to
c59a137
Compare
8826476
to
2790615
Compare
54da1a8
to
296f458
Compare
…r than attempting to run; removed some uAMQP-only features (Azure#5986) * Checkpoint of connection logic * Started implementing Rust based Connection by pulling out uAMQP artifacts * Implemented AMQP Connection in Rust; started API surface refactoring for Rust APIs; Refactored tests to remove some uAMQP only elements. * Don't leak runtime context on calls * export UUID from AMQP * clang-format
…ts pass or fail at this point
2790615
to
9f73c3e
Compare
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.
Reviewed the 112/383 files as best I could at a high level.
I believe the rest are all file renames without changes.
@@ -58,6 +58,7 @@ function(generate_documentation PROJECT_NAME PROJECT_VERSION) | |||
set(DOXYGEN_REPEAT_BRIEF NO) | |||
|
|||
doxygen_add_docs(${PROJECT_NAME}-docs | |||
./inc ./README.md |
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.
Will this have any impact on the "root readmes" being published for each package? For example, if we exclude https://github.com/Azure/azure-sdk-for-cpp/blob/main/sdk/storage/azure-storage-blobs/README.md does that mean, the published docs won't have:
https://azuresdkdocs.blob.core.windows.net/$web/cpp/azure-storage-blobs/12.12.0/index.html
src/impl/uamqp/amqp/private/session_impl.hpp | ||
# src/impl/uamqp/models/amqp_detach.cpp | ||
# src/impl/uamqp/models/amqp_error.cpp | ||
# src/impl/uamqp/models/amqp_header.cpp | ||
# src/impl/uamqp/models/amqp_message.cpp | ||
# src/impl/uamqp/models/amqp_properties.cpp | ||
# src/impl/uamqp/models/amqp_transfer.cpp | ||
# src/impl/uamqp/models/amqp_value.cpp |
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.
Why are some of these commented out?
if (USE_UAMQP) | ||
add_library(azure-core-amqp ${AZURE_CORE_AMQP_SOURCE} ${AZURE_CORE_AMQP_HEADER} ${AZURE_UAMQP_SOURCE} $<TARGET_OBJECTS:uamqp>) | ||
elseif(USE_RUST_AMQP) | ||
add_library(azure-core-amqp ${AZURE_CORE_AMQP_SOURCE} ${AZURE_CORE_AMQP_HEADER}) | ||
add_library(azure-core-amqp ${AZURE_CORE_AMQP_SOURCE} ${AZURE_CORE_AMQP_HEADER} ${AZURE_RUST_AMQP_SOURCE}) |
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.
Are USE_UAMQP
and USE_RUST_AMQP
mutually exclusive? If so, should the above set(AZURE_RUST_AMQP_SOURCE ...
also be in an if/elseif rather than two independent if blocks? It might be easier to read and be consistent if we combine all the if/elseif into one block.
endif() | ||
|
||
if (USE_UAMQP) | ||
target_include_directories(azure-core-amqp SYSTEM PRIVATE ${UAMQP_INC_FOLDER}) | ||
target_include_directories(azure-core-amqp PRIVATE src/impl/uamqp/amqp/private src/impl/uamqp/amqp/network ${UAMQP_INC_FOLDER}) |
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.
Why are we including UAMQP_INC_FOLDER
twice (in both target_include_directories
calls)?
class RustThreadContext final { | ||
|
||
/** | ||
* @brief Represents the an implementation of the rust multithreaded runtime. |
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.
* @brief Represents the an implementation of the rust multithreaded runtime. | |
* @brief Represents an implementation of the rust multithreaded runtime. |
@@ -3,9 +3,7 @@ | |||
|
|||
#include "azure/core/amqp/internal/cancellable.hpp" | |||
|
|||
#if ENABLE_UAMQP |
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.
Are we able to remove this now because the entire file is conditionally compiled now?
|
||
using namespace Azure::Core::Diagnostics::_internal; | ||
using namespace Azure::Core::Diagnostics; | ||
using namespace Azure::Core::Amqp::_internal; |
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.
Spot checking the difference, and it looks like this file is identical to the one:
sdk/core/azure-core-amqp/src/impl/rust_amqp/amqp/claim_based_security.cpp
Except for this line 14 is above namespace Azure { namespace Core { namespace Amqp { namespace _detail {
here, and below in the rust amqp impl version.
Should they be identical?
Can you explain why we need two copies for what you are trying to achieve?
#if ENABLE_UAMQP | ||
GTEST_LOG_(INFO) << LinkState::Error << LinkState::Invalid << static_cast<LinkState>(92) | ||
<< LinkState::HalfAttachedAttachReceived; | ||
#endif |
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.
I am unable to follow/understand why we end up needing the #ifs in some of these tests, in these particular places. Can you provide some context on how you went about introducing these?
if (result) | ||
{ | ||
throw Azure::Messaging::EventHubs::_detail::EventHubsExceptionFactory:: | ||
CreateEventHubsException(result); | ||
} | ||
return true; |
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.
Should this be the inverse? That is:
if(result) return true;
endif() | ||
if (USE_RUST_AMQP) |
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.
elif?
Most of this change is refactoring code, but there is a significant difference in this PR:
doxygen really doesn't handle conditional compilation well if there are ambiguous filenames in the repo. A large part of how this refactoring works depends on the fact that there are files with the same name in two different locations, so doxygen doesn't do well with this.
To resolve the issue, I changed doxygen to scope to just files in the "inc" subdirectory and the readme.md file.
That may result in public APIs which are not in the "inc" directory being dropped, but we shouldn't have any public APIs which aren't in the "inc" subdirectory.