Skip to content

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

Merged
merged 6 commits into from
Jun 16, 2021
Merged

Conversation

heaths
Copy link
Member

@heaths heaths commented Jun 11, 2021

No description provided.

Copy link
Contributor

@rylev rylev left a 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.

#[derive(Clone, Debug)]
pub struct RetryOptions {
/// The algorithm to use for calculating retry delays.
pub(crate) mode: RetryMode,
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

@heaths
Copy link
Member Author

heaths commented Jun 11, 2021

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.

@heaths
Copy link
Member Author

heaths commented Jun 12, 2021

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.

Copy link
Contributor

@ctaggart ctaggart left a 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.

#[derive(Clone, Debug)]
pub struct RetryOptions {
/// The algorithm to use for calculating retry delays.
pub(crate) mode: RetryMode,
Copy link
Contributor

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.

@heaths
Copy link
Member Author

heaths commented Jun 15, 2021

I opened #300 to further the discussion on how we want the guidelines to end up in this regard.

@heaths heaths requested a review from rylev June 15, 2021 19:13
Copy link
Contributor

@rylev rylev left a 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>> {
Copy link
Contributor

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>> {
Copy link
Contributor

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.
Copy link
Contributor

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?

Copy link
Contributor

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 {
Copy link
Contributor

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?

@rylev rylev merged commit b29d8c4 into Azure:master Jun 16, 2021
@rylev rylev mentioned this pull request Jun 16, 2021
@heaths heaths deleted the retry-options branch July 28, 2021 05:16
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.

3 participants