Skip to content

Commit 76449bc

Browse files
committed
Use a struct to keep track of the Stream state
Integrates some changes from Azure#3279 to make merging that PR a little later easier.
1 parent 3fde08f commit 76449bc

File tree

18 files changed

+690
-597
lines changed

18 files changed

+690
-597
lines changed

sdk/core/azure_core/src/http/pager.rs

Lines changed: 114 additions & 78 deletions
Large diffs are not rendered by default.

sdk/cosmos/azure_data_cosmos/src/pipeline/mod.rs

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod signature_target;
66

77
pub use authorization_policy::AuthorizationPolicy;
88
use azure_core::http::{
9-
pager::PagerState,
9+
pager::{PagerOptions, PagerState},
1010
request::{options::ContentType, Request},
1111
response::Response,
1212
ClientOptions, Context, Method, RawResponse, RetryOptions,
@@ -115,25 +115,30 @@ impl CosmosPipeline {
115115
// We have to double-clone here.
116116
// First we clone the pipeline to pass it in to the closure
117117
let pipeline = self.pipeline.clone();
118-
let ctx = ctx.with_value(resource_link).into_owned();
119-
Ok(FeedPager::from_callback(move |continuation| {
120-
// Then we have to clone it again to pass it in to the async block.
121-
// This is because Pageable can't borrow any data, it has to own it all.
122-
// That's probably good, because it means a Pageable can outlive the client that produced it, but it requires some extra cloning.
123-
let pipeline = pipeline.clone();
124-
let mut req = base_request.clone();
125-
let ctx = ctx.clone();
126-
async move {
127-
if let PagerState::More(continuation) = continuation {
128-
req.insert_header(constants::CONTINUATION, continuation);
118+
let options = PagerOptions {
119+
context: ctx.with_value(resource_link).into_owned(),
120+
};
121+
Ok(FeedPager::from_callback(
122+
move |continuation, ctx| {
123+
// Then we have to clone it again to pass it in to the async block.
124+
// This is because Pageable can't borrow any data, it has to own it all.
125+
// That's probably good, because it means a Pageable can outlive the client that produced it, but it requires some extra cloning.
126+
let pipeline = pipeline.clone();
127+
let mut req = base_request.clone();
128+
let ctx = ctx.clone();
129+
async move {
130+
if let PagerState::More(continuation) = continuation {
131+
req.insert_header(constants::CONTINUATION, continuation);
132+
}
133+
134+
let resp = pipeline.send(&ctx, &mut req, None).await?;
135+
let page = FeedPage::<T>::from_response(resp).await?;
136+
137+
Ok(page.into())
129138
}
130-
131-
let resp = pipeline.send(&ctx, &mut req, None).await?;
132-
let page = FeedPage::<T>::from_response(resp).await?;
133-
134-
Ok(page.into())
135-
}
136-
}))
139+
},
140+
Some(options),
141+
))
137142
}
138143

139144
/// Helper function to read a throughput offer given a resource ID.

sdk/keyvault/azure_security_keyvault_certificates/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
### Breaking Changes
88

99
- `CertificateClient::create_certificate()` now returns a `Poller<CertificateOperation>`.
10+
- `CertificateClientListCertificatePropertiesOptions::method_options` is now `PagerOptions`.
11+
- `CertificateClientListCertificatePropertiesVersionsOptions::method_options` is now `PagerOptions`.
12+
- `CertificateClientListDeletedCertificatePropertiesOptions::method_options` is now `PagerOptions`.
13+
- `CertificateClientListIssuerPropertiesOptions::method_options` is now `PagerOptions`.
1014
- Removed `CertificateClient::begin_create_certificate()`.
1115
- Removed `CertificateClient::resume_create_certificate()`.
1216
- Removed `wait()` function from `Poller<CertificateOperation>`.

0 commit comments

Comments
 (0)