Update sentry-rust monorepo to 0.35.0 #6
1 changed files with 83 additions and 77 deletions
|
@ -97,7 +97,12 @@ impl CaStore {
|
||||||
let string_id = lexicographic_base64::encode(id.to_be_bytes());
|
let string_id = lexicographic_base64::encode(id.to_be_bytes());
|
||||||
let source_fname = format!("temp/{string_id}");
|
let source_fname = format!("temp/{string_id}");
|
||||||
|
|
||||||
/*info!("Starting multipart upload {id}");
|
let mut buf = BytesMut::with_capacity(5_000_000);
|
||||||
|
reader.read_buf(&mut buf).await?;
|
||||||
|
let hasher = Arc::new(Mutex::new(Hasher::new()));
|
||||||
|
|
||||||
|
let hash = if buf.len() >= 5_000_000 {
|
||||||
|
info!("Starting multipart upload {id}");
|
||||||
let multipart_result = self
|
let multipart_result = self
|
||||||
.client
|
.client
|
||||||
.create_multipart_upload()
|
.create_multipart_upload()
|
||||||
|
@ -107,6 +112,8 @@ impl CaStore {
|
||||||
.await
|
.await
|
||||||
.with_context(|| format!("Creating multipart request for Request ID{id}"))?;
|
.with_context(|| format!("Creating multipart request for Request ID{id}"))?;
|
||||||
|
|
||||||
|
let mut reader = buf.chain(reader);
|
||||||
|
|
||||||
let mut buf = BytesMut::with_capacity(16 * 1024 * 1024); // 16MiB byte buffer for the file
|
let mut buf = BytesMut::with_capacity(16 * 1024 * 1024); // 16MiB byte buffer for the file
|
||||||
let hasher = Arc::new(Mutex::new(Hasher::new()));
|
let hasher = Arc::new(Mutex::new(Hasher::new()));
|
||||||
|
|
||||||
|
@ -163,11 +170,9 @@ impl CaStore {
|
||||||
.set_upload_id(multipart_result.upload_id)
|
.set_upload_id(multipart_result.upload_id)
|
||||||
.send()
|
.send()
|
||||||
.await
|
.await
|
||||||
.context("Completing multipart upload")?;*/
|
.context("Completing multipart upload")?;
|
||||||
|
hash
|
||||||
let hasher = Arc::new(Mutex::new(Hasher::new()));
|
} else {
|
||||||
let mut buf = Vec::new();
|
|
||||||
reader.read_to_end(&mut buf).await?;
|
|
||||||
let buf = Bytes::from(buf);
|
let buf = Bytes::from(buf);
|
||||||
let buf2 = buf.clone();
|
let buf2 = buf.clone();
|
||||||
let hasher2 = Arc::clone(&hasher);
|
let hasher2 = Arc::clone(&hasher);
|
||||||
|
@ -184,7 +189,8 @@ impl CaStore {
|
||||||
.await
|
.await
|
||||||
.context("Uploading file")?;
|
.context("Uploading file")?;
|
||||||
|
|
||||||
let hash = hasher.lock().await.finalize();
|
hasher.lock().await.finalize()
|
||||||
|
};
|
||||||
|
|
||||||
let target_fname = lexicographic_base64::encode(hash.as_bytes());
|
let target_fname = lexicographic_base64::encode(hash.as_bytes());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue