Skip to content

Commit

Permalink
Make it possible to nest runtime components
Browse files Browse the repository at this point in the history
  • Loading branch information
jdisanti committed Aug 8, 2023
1 parent 5675a69 commit a8e8686
Show file tree
Hide file tree
Showing 11 changed files with 307 additions and 38 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ message = "`RuntimeComponents` and `RuntimeComponentsBuilder` are now re-exporte
references = ["smithy-rs#2904"]
meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client"}
author = "jdisanti"

[[smithy-rs]]
message = "It's now possible to nest runtime components with the `RuntimePlugin` trait. A `current_components` argument was added to the `runtime_components` method so that components configured from previous runtime plugins can be referenced in the current runtime plugin. Ordering of runtime plugins was also introduced via a new `RuntimePlugin::order` method."
references = ["smithy-rs#2909"]
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client"}
author = "jdisanti"
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ impl RuntimePlugin for SigV4PresigningRuntimePlugin {
Some(layer.freeze())
}

fn runtime_components(&self) -> Cow<'_, RuntimeComponentsBuilder> {
fn runtime_components(
&self,
_: &RuntimeComponentsBuilder,
) -> Cow<'_, RuntimeComponentsBuilder> {
Cow::Borrowed(&self.runtime_components)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ConfigOverrideRuntimePluginGenerator(
Some(self.config.clone())
}
fn runtime_components(&self) -> #{Cow}<'_, #{RuntimeComponentsBuilder}> {
fn runtime_components(&self, _: &#{RuntimeComponentsBuilder}) -> #{Cow}<'_, #{RuntimeComponentsBuilder}> {
#{Cow}::Borrowed(&self.components)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class OperationRuntimePluginGenerator(
#{Some}(cfg.freeze())
}
fn runtime_components(&self) -> #{Cow}<'_, #{RuntimeComponentsBuilder}> {
fn runtime_components(&self, _: &#{RuntimeComponentsBuilder}) -> #{Cow}<'_, #{RuntimeComponentsBuilder}> {
// Retry classifiers are operation-specific because they need to downcast operation-specific error types.
let retry_classifiers = #{RetryClassifiers}::new()
#{retry_classifier_customizations};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class ServiceRuntimePluginGenerator(
self.config.clone()
}
fn runtime_components(&self) -> #{Cow}<'_, #{RuntimeComponentsBuilder}> {
fn runtime_components(&self, _: &#{RuntimeComponentsBuilder}) -> #{Cow}<'_, #{RuntimeComponentsBuilder}> {
#{Cow}::Borrowed(&self.runtime_components)
}
}
Expand Down
3 changes: 3 additions & 0 deletions rust-runtime/aws-smithy-runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ tokio = { version = "1.25", features = ["sync"] }
tracing = "0.1"
zeroize = { version = "1", optional = true }

[dev-dependencies]
tokio = { version = "1.25", features = ["rt", "macros"] }

[package.metadata.docs.rs]
all-features = true
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
Loading

0 comments on commit a8e8686

Please sign in to comment.