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: limit the interval for updating quota #288

Merged

Conversation

forcodedancing
Copy link
Contributor

@forcodedancing forcodedancing commented Jun 14, 2023

Description

This pr will limit the interval for updating bucket read quota.

Rationale

If there is no limit, a user can change the quota smaller at anytime to pay less.

Example

NA

Changes

Notable changes:

  • add new parameter

@forcodedancing forcodedancing requested a review from unclezoro June 20, 2023 02:46
store := ctx.KVStore(k.storeKey)
bz := make([]byte, 8)
binary.BigEndian.PutUint64(bz, timestamp)
store.Set(types.GetQuotaKey(bucketId), bz)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the quota update time be stored directly in bucketInfo? It didn't feel necessary to add a separate key

Copy link
Contributor

Choose a reason for hiding this comment

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

Or, I think we should separate some frequently modified fields from bucketInfo as a separate key-value.

Copy link
Contributor Author

@forcodedancing forcodedancing Jun 25, 2023

Choose a reason for hiding this comment

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

the update frequency of quote is very low, or even no update at all.
currently, if there is no update, it will not be stored (just use bucket' creation time).

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.

4 participants