-
Notifications
You must be signed in to change notification settings - Fork 290
Move get blob to pageable #850
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
Note, the Continuation code for all of the generated crates will need to be updated, though the update is minimal. I will do that tomorrow. |
pub trait Continuable { | ||
fn continuation(&self) -> Option<String>; | ||
fn continuation(&self) -> Option<Continuation>; |
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 any endpoints allow for multiple types of continuations? It seems like right now the Continuation
header with a continuation token is the happy path and we're using panics to ensure that we don't use a Continuation::Range
when we don't meant time.
What if we were to trying the following;
pub trait Continuable {
type Continuation: crate::AsHeaders;
fn continuation(&self) -> Option<Self::Continuation>;
}
The make_request
function then becomes impl Fn(Option<T::Continuation>) -> F + Clone + 'static + Send
This would make the system more robust. Every continuable response just needs to provide the headers it uses for specifying how it continues.
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.
Examples of different Continuation methods:
- BlobClient.get uses Range header
- Cosmos's list_attachments uses
Continuation
header - ContainerClient.list_blobs uses
marker
URI parameter - datalake's file_systems_list uses
maker
URI parameter. Note, this one also accepts next_marker from the builder, which probably shouldn't be available.
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.
Ok so we couldn't do type Continuation: crate::AsHeaders
but we could do type Continuation: crate::AsContinuation
and implement AsContinuation
for all the appropriate types.
@@ -173,6 +129,62 @@ impl Continuable for GetBlobResponse { | |||
} | |||
} | |||
|
|||
// caclculate the first Range for use at the beginning of the Pageable. |
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.
FYI: even though these are internal APIs they should still be ///
doc comments so that they show up in rust-analyzer.
This PR does two main things:
Continuation
model to support String (as used by most of the SDKs) andRange
as used byget_blob
.get_blob
to not require the user to specify a chunk size, but by default will download in 1MB chunks. I think this simplifies the interface while also not shooting the user in the foot by default downloading the entire blob into memory.