-
Notifications
You must be signed in to change notification settings - Fork 196
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
Add support for TimeStreamWrite and TimeStreamQuery #2707
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
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.
This looks good, but seems like it is missing tests.
/// | ||
/// # Panics | ||
/// This function panics if it is called from an asynchronous context | ||
pub fn try_blocking_get(&self) -> Option<T> { |
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.
Doesn't look like this is used?
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.
yeah deleted, an artifact from a previous impl
...n/src/main/kotlin/software/amazon/smithy/rustsdk/customize/timestream/TimestreamDecorator.kt
Show resolved
Hide resolved
...n/src/main/kotlin/software/amazon/smithy/rustsdk/customize/timestream/TimestreamDecorator.kt
Outdated
Show resolved
Hide resolved
@@ -204,6 +204,7 @@ class ServiceConfigGenerator(private val customizations: List<ConfigCustomizatio | |||
customizations.forEach { | |||
it.section(ServiceConfig.ConfigStructAdditionalDocs)(writer) | |||
} | |||
Attribute(Attribute.derive(RuntimeType.Clone)).render(writer) |
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.
Would be awesome if this could also derive Debug
instead of the Debug
impl that just outputs "Config"
…hange warning is spurious) (#2728) ## Motivation and Context - #2262 - #2087 - #2707 This adds `TimeSource` in SDK and service configs so we can effectively control time when executing requests with the SDK at the client level. _note:_ the breaking change is in a trait implementation of a struct we're going to delete, not a real breaking change ## Description - Add `SharedTimeSource` and use it in SdkConfig / `aws-config` / <service>::Config - Wire up the signer and other uses of `SystemTime::now()` that I could find - track down broken tests ## Testing - [x] various unit tests that all still pass ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [x] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates - [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
This adds support for TSW and TSQ by adding endpoint discovery as a customization. This is made much simpler by the fact that endpoint discovery for these services **has no parameters** which means that there is no complexity from caching the returned endpoint. Customers call `.enable_endpoint_discovery()` on the client to create a version of the client with endpoint discovery enabled. This returns a new client and a Reloader from which customers must spawn the reload task if they want endpoint discovery to rerun.
760d379
to
47892e6
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
_ => {} | ||
} | ||
self.reload_increment(self.time.now()).await; | ||
self.sleep.sleep(Duration::from_secs(60)).await; |
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.
How was the 1min increment decided? A comment would be appreciated.
tracing::debug!(expiry = ?self.expiry, now = ?now, delta = ?self.expiry.duration_since(now), "checking expiry status of endpoint"); | ||
match self.expiry.duration_since(now) { | ||
Err(_) => true, | ||
Ok(t) => t < Duration::from_secs(120), |
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'm guessing this value is meant to always be 2x the 1min duration, perhaps linking them together with const
s would be a good idea. Of course, if we're never going to touch this stuff again then it's not important.
// if we didn't successfully get an endpoint, bail out so the client knows | ||
// configuration failed to work |
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.
// if we didn't successfully get an endpoint, bail out so the client knows | |
// configuration failed to work | |
// if we failed to get an endpoint from the cache, bail out so that the client knows | |
// that configuration failed |
.lock() | ||
.unwrap() | ||
.as_ref() | ||
.map(|e| e.endpoint.clone()) |
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.
Do we need a map
? Can't we just call clone
directly?
.map(|e| e.endpoint.clone()) | |
.clone() |
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.
this is plucking out the endpoint in the map (not just cloning)
* 1. Adds the `endpoint_discovery` inlineable | ||
* 2. Adds a `enable_endpoint_discovery` method on client that returns a wrapped client with endpoint discovery enabled | ||
*/ | ||
class TimestreamDecorator : ClientCodegenDecorator { |
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.
Did you actually use the crate docs decorator anywhere? I would have assumed there'd be something in here about how timestream support is experimental.
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 generated docs that add enable_endpoint_discovery
—I figure our standard boilerplate is probably good for starters
TODO:
Motivation and Context
Description
This adds support for TSW and TSQ by adding endpoint discovery as a customization. This is made much simpler by the fact that endpoint discovery for these services has no parameters which means that there is no complexity from caching the returned endpoint.
Customers call
.enable_endpoint_discovery()
on the client to create a version of the client with endpoint discovery enabled. This returns a new client and a Reloader from which customers must spawn the reload task if they want endpoint discovery to rerun.Testing
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.