Skip to content

create interface for write data api, implement in CRT#3789

Open
sbiscigl wants to merge 1 commit intomainfrom
crt-write-data-api
Open

create interface for write data api, implement in CRT#3789
sbiscigl wants to merge 1 commit intomainfrom
crt-write-data-api

Conversation

@sbiscigl
Copy link
Copy Markdown
Collaborator

@sbiscigl sbiscigl commented Apr 6, 2026

Description of changes:

The change creates a new function for the interface for our HTTPClient called AcquireConnection . The idea here is to create a API that does not rely on polling to read more data. this created issues where we saw hot polling such as in transcribe streaming. The way this API could be invoked is

auto connection = client.AcquireConnection();
auto clientStream = connection.NewClientStream();
clientStream.WriteData(...)
clientStream.WriteData(...)

This create a foundation for non-blocking io where the http client is not waiting for more data, but instead we have have a write API to do this.

Projects like the amazon-transcribe-streaming-sdk used this exact API in the same way to eliminate hot polling.

Added a test in dynamodb to write data over a created connection using the new API. The integration tests exists there because dynamo has http2 apis, and unit testing the CRT is not feasible for this change.

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 force-pushed the crt-write-data-api branch from d25cc72 to ba65c36 Compare April 6, 2026 19:43
@sbiscigl sbiscigl marked this pull request as ready for review April 6, 2026 19:43
@sbiscigl sbiscigl force-pushed the crt-write-data-api branch 2 times, most recently from 87d1dfd to b0644c8 Compare April 6, 2026 21:11
@sbiscigl sbiscigl force-pushed the crt-write-data-api branch from b0644c8 to 17eb7ad Compare April 7, 2026 13:47
}
}

Aws::Http::HttpClient::AcquireConnectionOutcome CRTHttpClient::AcquireConnection(const std::shared_ptr<HttpRequest>& request) {
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.

Just an idea but is it worth making this (or adding a seperate function) that acquires the connection without blocking i/o? Allows us to potentially lazy-init the connection when we implement the stream that uses these new API's

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.

lets make this one non-blocking, its very easy to make this blocking for our use case, but very hard to make it non blocking in the future. changing

*/

#pragma once
#include <aws/core/utils/memory/stl/AWSStreamFwd.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.

super nit: we are transitively including AWS_CORE_API somewhere and that's why AWS_CORE_API works but we should explicitly include #include <aws/core/Core_EXPORTS.h>

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.

2 participants