forked from Deuxfleurs/garage
refactor
This commit is contained in:
parent
8b1338ef2f
commit
e92c52eb65
1 changed files with 9 additions and 19 deletions
|
@ -103,18 +103,18 @@ pub async fn handle_get_bucket_info(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bucket_info_results(garage, bucket_id).await
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn bucket_info_results(
|
||||||
|
garage: &Arc<Garage>,
|
||||||
|
bucket_id: Uuid,
|
||||||
|
) -> Result<Response<Body>, Error> {
|
||||||
let bucket = garage
|
let bucket = garage
|
||||||
.bucket_helper()
|
.bucket_helper()
|
||||||
.get_existing_bucket(bucket_id)
|
.get_existing_bucket(bucket_id)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
bucket_info_results(garage, bucket).await
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn bucket_info_results(
|
|
||||||
garage: &Arc<Garage>,
|
|
||||||
bucket: Bucket,
|
|
||||||
) -> Result<Response<Body>, Error> {
|
|
||||||
let mut relevant_keys = HashMap::new();
|
let mut relevant_keys = HashMap::new();
|
||||||
for (k, _) in bucket
|
for (k, _) in bucket
|
||||||
.state
|
.state
|
||||||
|
@ -299,12 +299,7 @@ pub async fn handle_create_bucket(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let bucket = garage
|
bucket_info_results(garage, bucket.id).await
|
||||||
.bucket_table
|
|
||||||
.get(&EmptyKey, &bucket.id)
|
|
||||||
.await?
|
|
||||||
.ok_or_internal_error("Bucket should now exist but doesn't")?;
|
|
||||||
bucket_info_results(garage, bucket).await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -425,12 +420,7 @@ pub async fn handle_bucket_change_key_perm(
|
||||||
.set_bucket_key_permissions(bucket.id, &key.key_id, perm)
|
.set_bucket_key_permissions(bucket.id, &key.key_id, perm)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let bucket = garage
|
bucket_info_results(garage, bucket.id).await
|
||||||
.bucket_table
|
|
||||||
.get(&EmptyKey, &bucket.id)
|
|
||||||
.await?
|
|
||||||
.ok_or_internal_error("Bucket should now exist but doesn't")?;
|
|
||||||
bucket_info_results(garage, bucket).await
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
|
Loading…
Reference in a new issue