-
Notifications
You must be signed in to change notification settings - Fork 283
Use ClientOptions to create Pipeline #288
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
Conversation
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.
Looking good! I'd like to see this used in the examples folder in Cosmos (at least once) just so we can see some of this in action.
sdk/core/src/options.rs
Outdated
#[derive(Clone, Debug)] | ||
pub struct RetryOptions { | ||
/// The algorithm to use for calculating retry delays. | ||
pub(crate) mode: RetryMode, |
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.
nit: if we have setters already is there a need for the pub(crate)
annotation on the fields?
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 need to access these in scopes that are children of a sibling scope.
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 not sure I understand why. I checkout out this branch, removed the pub(crate)
and it compiles.
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'll try it. The docs said (paraphrasing - or perhaps I misunderstood entirely) that pub(crate)
was necessary to access members of sibling mods, or children of sibling mods.
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 was able to remove them from some of the members but not all. Started with removing them all and added them back in as needed.
Oh, and I forgot to add some more examples like you mentioned in your overarching comment. I'll do that this weekend before merging if you feel appropriate to change your vote. |
I opened #294 to track moving (exposing) request methods from the pipeline itself, like with our other SDKs, to abstract away the requests from the wire protocol. |
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.
Pipeline is looking better. I especially like the example in doc comments.
sdk/core/src/options.rs
Outdated
#[derive(Clone, Debug)] | ||
pub struct RetryOptions { | ||
/// The algorithm to use for calculating retry delays. | ||
pub(crate) mode: RetryMode, |
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 not sure I understand why. I checkout out this branch, removed the pub(crate)
and it compiles.
I opened #300 to further the discussion on how we want the guidelines to end up in this regard. |
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.
Looks good. I had some additional questions and nits, but I'd like to see this merged ASAP
|
||
impl ClientOptions { | ||
/// A mutable reference to per-call policies. | ||
pub fn mut_per_call_policies(&mut self) -> &mut Vec<Arc<dyn Policy>> { |
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.
The idiomatic form is per_call_policies_mut
} | ||
|
||
/// A mutable reference to per-retry policies. | ||
pub fn mut_per_retry_policies(&mut self) -> &mut Vec<Arc<dyn Policy>> { |
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.
Same as above
|
||
/// Gets the `HttpClient` used by the pipeline. | ||
pub fn http_client(&self) -> &dyn HttpClient { | ||
// TODO: Request methods should be defined directly on the pipeline instead of exposing the HttpClient. |
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.
Can you create an issue for this?
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.
Ah I see that there's this: #294. Might be worth in the future having all todos link to an issue
max_delay: Duration::from_secs(10), | ||
impl FixedRetryPolicy { | ||
pub(crate) fn new(delay: Duration, max_retries: u32, max_delay: Duration) -> Self { | ||
FixedRetryPolicy { |
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 the change away from Self
?
No description provided.