Skip to content

Commit

Permalink
feat(mbuild): resumable-upload infrastructure
Browse files Browse the repository at this point in the history
Layout the `ResumableUploadHelper` and implement the entire logic
with the mbuild renerator.

All that's left to be done is to implement the 'chunked upload' method.

The borrow checker helped me to prevent a bug as well.
  • Loading branch information
Byron committed Mar 21, 2015
1 parent 98f4bba commit 307d3f4
Show file tree
Hide file tree
Showing 5 changed files with 754 additions and 350 deletions.
26 changes: 26 additions & 0 deletions gen/youtube3/src/cmn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,30 @@ impl<'a> Read for MultiPartReader<'a> {
}
}
}
}


/// The `X-Upload-Content-Type` header.
#[derive(Clone, PartialEq, Debug)]
pub struct XUploadContentType(pub Mime);

impl_header!(XUploadContentType,
"X-Upload-Content-Type",
Mime);

/// A utility type to perform a resumable upload from start to end.
pub struct ResumableUploadHelper<'a, NC: 'a> {
pub client: &'a mut hyper::client::Client<NC>,
pub delegate: &'a mut Delegate,
pub url: &'a str,
pub reader: &'a mut ReadSeek,
pub media_type: Mime,
pub content_size: u64
}

impl<'a, NC> ResumableUploadHelper<'a, NC>
where NC: hyper::net::NetworkConnector {
pub fn upload(&'a mut self) -> hyper::HttpResult<hyper::client::Response> {
Err(hyper::error::HttpError::HttpStatusError)
}
}
Loading

0 comments on commit 307d3f4

Please sign in to comment.