Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support delete bucket with non-zero charged read quota #131

Merged
merged 1 commit into from
Mar 24, 2023

Conversation

owen-reorg
Copy link
Contributor

Description

Previously a bucket with a non-zero charged read quota cannot be deleted.
This PR supports that by changing the billing info in that transaction.

Rationale

Make it easier for users to delete a bucket. They don't need to update the charged read quota to zero first before deleting it.

Example

NA

Changes

Notable changes:

  • Change the billing info in DeleteBucket

@owen-reorg owen-reorg requested a review from fynnss March 24, 2023 06:00
@unclezoro unclezoro merged commit e4879c0 into develop Mar 24, 2023
@@ -23,7 +23,7 @@ var (
ErrSourceTypeMismatch = errors.Register(ModuleName, 1114, "Object source type mismatch")
ErrTooLargeObject = errors.Register(ModuleName, 1115, "Object payload size is too large")
ErrInvalidApproval = errors.Register(ModuleName, 1116, "Invalid approval of sp")
ErrBucketBillNotEmpty = errors.Register(ModuleName, 1117, "bucket bill is not empty")
ErrCharge = errors.Register(ModuleName, 1117, "charge error")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about ErrChargeFailed ?

}
// should only remain at most 2 flows: charged_read_quota fee and tax
if len(bill.Flows) > 2 {
return fmt.Errorf("unexpected left flow number: %d", len(bill.Flows))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this error occurs, how should the user handle it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should never happen, unless we have a bug(e.g. there is still object in the bucket, but somehow it passes the check).

@unclezoro unclezoro added the r4r label Mar 24, 2023
@unclezoro unclezoro deleted the delete-bucket-with-read-quota branch April 18, 2023 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants