Skip to content

Feat/space quotas#514

Merged
roman-khimov merged 4 commits intomasterfrom
feat/space-quotas
Sep 5, 2025
Merged

Feat/space quotas#514
roman-khimov merged 4 commits intomasterfrom
feat/space-quotas

Conversation

@carpawell
Copy link
Member

No description provided.

@carpawell carpawell self-assigned this Sep 2, 2025
@carpawell carpawell marked this pull request as ready for review September 2, 2025 17:44
@codecov
Copy link

codecov bot commented Sep 2, 2025

Codecov Report

❌ Patch coverage is 82.57576% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.50%. Comparing base (fa7e98a) to head (c7b55dc).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
contracts/container/contract.go 82.44% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #514      +/-   ##
==========================================
+ Coverage   61.72%   62.50%   +0.78%     
==========================================
  Files          23       24       +1     
  Lines        3339     3470     +131     
==========================================
+ Hits         2061     2169     +108     
- Misses       1278     1301      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

}

// PutContainerQuota sets size quota that limits all space used for storing
// objects in cID (including object replicas). Non-positive size sets no
Copy link
Contributor

Choose a reason for hiding this comment

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

negatives are senseless for now imo, i'd leave zero for reset only

Copy link
Member Author

Choose a reason for hiding this comment

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

we cannot ensure this via VM's types in NEO, so either we check it or try to treat it as a normal situation. i would prefer to allow negatives, meaning any values above are ok

Copy link
Contributor

Choose a reason for hiding this comment

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

passing -42 is nonsense to me. Sizes are naturally unsigned

return q.(Quota)
}

// PutUserQuota sets size quota that limits all space used for storing objects
Copy link
Contributor

Choose a reason for hiding this comment

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

this can also be used out of container ownership context. For example, if I have no containers, but I upload data to someone else's. Right? lookin at implementation

Copy link
Member Author

Choose a reason for hiding this comment

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

tbh initially i meant that user quota == sum of every object that was put to a container this user has. i did not think about sum of objects that the user uploaded (even to other users' containers). i am not sure it can be precisely calculated how many objects a certain user has uploaded by a node, it just does not know the other node's infos. moreover, i do not understand what user's quota means then: this user set it and this user uploads objects with this user's wallet. what is the restriction then?

@roman-khimov

Copy link
Member

@roman-khimov roman-khimov Sep 4, 2025

Choose a reason for hiding this comment

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

Currently user is bucket owner, we don't really have object ownership concept in NeoFS, quotas can only be tied to containers (and their owners).

Copy link
Contributor

Choose a reason for hiding this comment

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

doubt this fact. If so, to upload data, any side would need to create a container

Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

Can we have both soft and hard limits set for a container? Do we track space occupied by account?

@carpawell
Copy link
Member Author

Can we have both soft and hard limits set for a container?

No.

@roman-khimov
Copy link
Member

Can we have both soft and hard limits set for a container?

No.

I think @EESergey might like it.

@carpawell
Copy link
Member Author

Do we track space occupied by account?

Can be calculated as the sum of all his containers. No direct api for now, but a few lines inside the contract, and simple side calculations if needed by nodes (i think every node will update their container understanding for all containers at once). Do you want this getter from a contract?

@EESergey
Copy link

EESergey commented Sep 4, 2025

Can we have both soft and hard limits set for a container?

No.

I think @EESergey might like it.

The soft quota is for notification.
Stopping the upload of objects when the hard quota is reached can be an emergency.
There should be a notification mechanism before the upload stops.

@roman-khimov
Copy link
Member

simple side calculations if needed by nodes

10K containers.

Do you want this getter from a contract?

I do. It's trivial to update yet another counter in the contract.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Drop Start/Stop estimations events, they are not produced anymore.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Provide setters for per-container and per-user limitation. Storage nodes
starting from the next release are obliged to comply these limitations from the
corresponding getters. User and container limitations are independent and can
conflicts: in this case the lower threshold is dominant. Closes #505.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
@roman-khimov roman-khimov merged commit 50f4c2c into master Sep 5, 2025
10 checks passed
@roman-khimov roman-khimov deleted the feat/space-quotas branch September 5, 2025 12:33
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 10, 2025
Refs nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 11, 2025
Add support for quotas and total container and account sizes from
nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 11, 2025
Refs nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 12, 2025
Add support for quotas and total container and account sizes from
nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 12, 2025
Refs nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 15, 2025
Add support for quotas and total container and account sizes from
nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 15, 2025
Refs nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 16, 2025
Add support for quotas and total container and account sizes from
nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 16, 2025
Refs nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 17, 2025
Add support for quotas and total container and account sizes from
nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 17, 2025
Refs nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 17, 2025
Add support for quotas and total container and account sizes from
nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 17, 2025
Refs nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 19, 2025
Add support for quotas and total container and account sizes from
nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 19, 2025
Refs nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 22, 2025
Add support for quotas and total container and account sizes from
nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Sep 22, 2025
Refs nspcc-dev/neofs-contract#514.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants