mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-05 04:17:42 +00:00
api: change ExpectedChecksums to not be a reference
This commit is contained in:
+6
-7
@@ -149,15 +149,14 @@ pub async fn handle_copy(
|
||||
)
|
||||
.await?
|
||||
} else {
|
||||
let expected_checksum = ExpectedChecksums {
|
||||
md5: None,
|
||||
sha256: None,
|
||||
extra: source_checksum,
|
||||
};
|
||||
let checksum_mode = if was_multipart || source_checksum_algorithm != checksum_algorithm {
|
||||
ChecksumMode::Calculate(checksum_algorithm)
|
||||
} else {
|
||||
ChecksumMode::Verify(&expected_checksum)
|
||||
ChecksumMode::Verify(ExpectedChecksums {
|
||||
md5: None,
|
||||
sha256: None,
|
||||
extra: source_checksum,
|
||||
})
|
||||
};
|
||||
// For multipart uploads that had a composite checksum, set checksum type
|
||||
// to full object as it will be recalculated.
|
||||
@@ -345,7 +344,7 @@ async fn handle_copy_reencrypt(
|
||||
source_version: &ObjectVersion,
|
||||
source_version_data: &ObjectVersionData,
|
||||
source_encryption: EncryptionParams,
|
||||
checksum_mode: ChecksumMode<'_>,
|
||||
checksum_mode: ChecksumMode,
|
||||
) -> Result<SaveStreamResult, Error> {
|
||||
// basically we will read the source data (decrypt if necessary)
|
||||
// and save that in a new object (encrypt if necessary),
|
||||
|
||||
@@ -262,7 +262,7 @@ pub async fn handle_post_object(
|
||||
encryption,
|
||||
StreamLimiter::new(stream, conditions.content_length),
|
||||
&key,
|
||||
ChecksumMode::Verify(&expected_checksums),
|
||||
ChecksumMode::Verify(expected_checksums),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
||||
+3
-3
@@ -48,8 +48,8 @@ pub(crate) struct SaveStreamResult {
|
||||
pub(crate) etag: String,
|
||||
}
|
||||
|
||||
pub(crate) enum ChecksumMode<'a> {
|
||||
Verify(&'a ExpectedChecksums),
|
||||
pub(crate) enum ChecksumMode {
|
||||
Verify(ExpectedChecksums),
|
||||
VerifyFrom {
|
||||
checksummer: StreamingChecksumReceiver,
|
||||
trailer_algo: Option<ChecksumAlgorithm>,
|
||||
@@ -140,7 +140,7 @@ pub(crate) async fn save_stream<S: Stream<Item = Result<Bytes, Error>> + Unpin>(
|
||||
encryption: EncryptionParams,
|
||||
body: S,
|
||||
key: &String,
|
||||
checksum_mode: ChecksumMode<'_>,
|
||||
checksum_mode: ChecksumMode,
|
||||
) -> Result<SaveStreamResult, Error> {
|
||||
let ReqCtx {
|
||||
garage, bucket_id, ..
|
||||
|
||||
Reference in New Issue
Block a user