Skip to content

Create class based on bound out BDD endpoint engine in crt#3870

Merged
sbiscigl merged 1 commit into
mainfrom
bdd-bind
Jul 22, 2026
Merged

Create class based on bound out BDD endpoint engine in crt#3870
sbiscigl merged 1 commit into
mainfrom
bdd-bind

Conversation

@sbiscigl

Copy link
Copy Markdown
Collaborator

Description of changes:

Binds out the CRT BDD endpoint engine into the SDK. refactors common components between different CRT endpoint provider implementations behind a template.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sbiscigl
sbiscigl marked this pull request as ready for review July 20, 2026 13:22
@sbiscigl
sbiscigl force-pushed the bdd-bind branch 7 times, most recently from 5f1c0e0 to 10f2ce0 Compare July 21, 2026 13:49
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/utils/base64/Base64.h>
#include <aws/core/utils/crypto/CRC64.h>
#include <aws/core/utils/memory/stl/AWSArray.h>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: include but not used

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it is used, the DefaultEndpointProvider included this transitively, now it doesnt, so where ever we are using it, we need to to include it now, i.e. same in transfer manager

Comment thread src/aws-cpp-sdk-core/include/aws/core/endpoint/BDDEndpointProvider.h Outdated
Comment thread tests/aws-cpp-sdk-core-tests/endpoint/BDDEndpointProviderTest.cpp Outdated
ClientContextParametersT> {
public:
CrtEndpointProvider(const char *endpointRulesBlob, const size_t endpointRulesBlobSz)
: m_crtEngine(Aws::Crt::ByteCursorFromArray((const uint8_t *) endpointRulesBlob, endpointRulesBlobSz),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One thing i wanna point out here since we are wrapping the raw pointer endpointRulesBlob in a ByteCursor (non-owning). The two engines slightly differ in construction:

  • RuleEngine's constructor calls aws_endpoints_ruleset_new_from_string which parses the JSON into it's internal DOM (copy)
  • BddEngine's constructor calls aws_endpoints_bdd_engine_new_from_bytecode on the partitions blob (copy), but explicitly states that the caller is responsible for keeping the bytecode buffer alive

For the BDD path, should we ensure the lifetime of that cursor by copying it into a Aws::Vector<uint8_t> or Aws::String member member variable before constructing?

ex.

BDDEndpointProvider(const char* endpointRulesBlob, const size_t endpointRulesBlobSz)
      // Copy the bytecode into a member first
      : m_ownedBytecode(reinterpret_cast<const uint8_t*>(endpointRulesBlob),
                        reinterpret_cast<const uint8_t*>(endpointRulesBlob) + endpointRulesBlobSz),
        Base(reinterpret_cast<const char*>(m_ownedBytecode.data()), m_ownedBytecode.size())

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

good callout, and we solve this through our constexpr ruleset blob, that puts the data firmly in .rodata so we never have to worry about lifetimes. Lets address this the same as CRT and add a loud warning comment. Anyone who will newly subclass this for their own endpoint provider will have to do so explicitly the only path they would get it is if they didnt hav a custom endpoint provider, so it would be a new code path. Lets add a warning to match CRT.

@sbiscigl
sbiscigl added this pull request to the merge queue Jul 22, 2026
Merged via the queue into main with commit 5253bbf Jul 22, 2026
3 of 6 checks passed
@sbiscigl
sbiscigl deleted the bdd-bind branch July 22, 2026 15:23
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.

4 participants