fix: ensure s3 blob uploads are streaming
The existing code buffered the whole thing into vec which defeated the purpose of `put_stream`.
238 unmodified linesExpand all23924024124224324324424524624783 unmodified lines331332333334335336337335336337338339389 unmodified linesExpand all238 unmodified linesExpand all
async fn put_stream( &self, key: &str, stream: Pin<Box<dyn Stream<Item = Result<Bytes, std::io::Error>> + Send>>, mut stream: Pin<Box<dyn Stream<Item = Result<Bytes, std::io::Error>> + Send>>, ) -> Result<StreamUploadResult, StorageError> { use futures::StreamExt;
let path = self.resolve_path(key);83 unmodified lines
let result: Result<UploadState, StorageError> = { let mut state = initial_state;
let chunk_results: Vec<Result<Bytes, std::io::Error>> = stream.collect().await;
for chunk_result in chunk_results { while let Some(chunk_result) = stream.next().await { match chunk_result { Ok(chunk) => { state.hasher.update(&chunk); state.total_size += chunk.len() as u64;389 unmodified linesExpand all