cargo fmt

This commit is contained in:
Alex 2023-05-03 16:43:36 +02:00
parent c1e1764f17
commit bb176ebcb8

View file

@ -119,11 +119,15 @@ impl AdminRpcHandler {
.get(&br.version, &EmptyKey) .get(&br.version, &EmptyKey)
.await? .await?
{ {
self.handle_block_purge_version_backlink(&version, &mut obj_dels, &mut mpu_dels).await?; self.handle_block_purge_version_backlink(
&version,
&mut obj_dels,
&mut mpu_dels,
)
.await?;
if !version.deleted.get() { if !version.deleted.get() {
let deleted_version = let deleted_version = Version::new(version.uuid, version.backlink, true);
Version::new(version.uuid, version.backlink, true);
self.garage.version_table.insert(&deleted_version).await?; self.garage.version_table.insert(&deleted_version).await?;
ver_dels += 1; ver_dels += 1;
} }
@ -140,11 +144,14 @@ impl AdminRpcHandler {
))) )))
} }
async fn handle_block_purge_version_backlink(&self, version: &Version, obj_dels: &mut usize, mpu_dels: &mut usize) -> Result<(), Error> { async fn handle_block_purge_version_backlink(
&self,
version: &Version,
obj_dels: &mut usize,
mpu_dels: &mut usize,
) -> Result<(), Error> {
let (bucket_id, key, ov_id) = match &version.backlink { let (bucket_id, key, ov_id) = match &version.backlink {
VersionBacklink::Object{bucket_id, key} => { VersionBacklink::Object { bucket_id, key } => (*bucket_id, key.clone(), version.uuid),
(*bucket_id, key.clone(), version.uuid)
}
VersionBacklink::MultipartUpload { upload_id } => { VersionBacklink::MultipartUpload { upload_id } => {
if let Some(mut mpu) = self.garage.mpu_table.get(&upload_id, &EmptyKey).await? { if let Some(mut mpu) = self.garage.mpu_table.get(&upload_id, &EmptyKey).await? {
if !mpu.deleted.get() { if !mpu.deleted.get() {
@ -160,12 +167,7 @@ impl AdminRpcHandler {
} }
}; };
if let Some(object) = self if let Some(object) = self.garage.object_table.get(&bucket_id, &key).await? {
.garage
.object_table
.get(&bucket_id, &key)
.await?
{
let ov = object.versions().iter().rev().find(|v| v.is_complete()); let ov = object.versions().iter().rev().find(|v| v.is_complete());
if let Some(ov) = ov { if let Some(ov) = ov {
if ov.uuid == ov_id { if ov.uuid == ov_id {
@ -176,9 +178,7 @@ impl AdminRpcHandler {
vec![ObjectVersion { vec![ObjectVersion {
uuid: del_uuid, uuid: del_uuid,
timestamp: ov.timestamp + 1, timestamp: ov.timestamp + 1,
state: ObjectVersionState::Complete( state: ObjectVersionState::Complete(ObjectVersionData::DeleteMarker),
ObjectVersionData::DeleteMarker,
),
}], }],
); );
self.garage.object_table.insert(&deleted_object).await?; self.garage.object_table.insert(&deleted_object).await?;
@ -189,5 +189,4 @@ impl AdminRpcHandler {
Ok(()) Ok(())
} }
} }