Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use std::collections::{BTreeMap, HashMap};
use std::convert::TryFrom;
use std::hash::Hash;
use std::pin::pin;
use std::sync::Arc;
use std::time::Duration;

Expand Down Expand Up @@ -665,15 +666,17 @@ impl Client {
/// Pushes a blob to the registry as a series of chunks from an input stream
///
/// Returns the pullable location of the blob
pub async fn push_blob_stream<T: Stream<Item = Result<bytes::Bytes>> + Unpin>(
pub async fn push_blob_stream<T: Stream<Item = Result<bytes::Bytes>>>(
&self,
image: &Reference,
mut blob_data_stream: T,
blob_data_stream: T,
blob_digest: &str,
) -> Result<String> {
let mut location = self.begin_push_chunked_session(image).await?;
let mut range_start = 0;

let mut blob_data_stream = pin!(blob_data_stream);

while let Some(blob_data) = blob_data_stream.next().await {
let mut blob_data = blob_data?;
while !blob_data.is_empty() {
Expand Down Expand Up @@ -1133,11 +1136,11 @@ impl Client {
/// descriptor. The image reference is used to find the repository and the registry, but it is
/// not used to verify that the digest is a layer inside of the image. (The manifest is used for
/// that.)
pub async fn pull_blob<T: AsyncWrite + Unpin>(
pub async fn pull_blob<T: AsyncWrite>(
&self,
image: &Reference,
layer: impl AsLayerDescriptor,
mut out: T,
out: T,
) -> Result<()> {
let response = self.pull_blob_response(image, &layer, None, None).await?;

Expand All @@ -1151,6 +1154,8 @@ impl Client {

let mut stream = response.error_for_status()?.bytes_stream();

let mut out = pin!(out);

while let Some(bytes) = stream.next().await {
let bytes = bytes?;
if let Some((ref mut digester, _)) = maybe_header_digester.as_mut() {
Expand Down