[#1677] writecache: Add QoS limiter usage
All checks were successful
DCO action / DCO (pull_request) Successful in 33s
Vulncheck / Vulncheck (pull_request) Successful in 1m14s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m22s
Build / Build Components (pull_request) Successful in 1m31s
Tests and linters / Run gofumpt (pull_request) Successful in 3m16s
Tests and linters / Lint (pull_request) Successful in 3m48s
Tests and linters / Staticcheck (pull_request) Successful in 3m45s
Tests and linters / gopls check (pull_request) Successful in 4m11s
Tests and linters / Tests with -race (pull_request) Successful in 6m9s
Tests and linters / Tests (pull_request) Successful in 4m6s
Vulncheck / Vulncheck (push) Successful in 1m11s
Pre-commit hooks / Pre-commit (push) Successful in 1m23s
Build / Build Components (push) Successful in 1m50s
Tests and linters / Run gofumpt (push) Successful in 3m30s
Tests and linters / Lint (push) Successful in 3m49s
Tests and linters / Tests with -race (push) Successful in 3m53s
Tests and linters / Staticcheck (push) Successful in 3m51s
Tests and linters / gopls check (push) Successful in 4m23s
Tests and linters / Tests (push) Successful in 4m30s
OCI image / Build container images (push) Successful in 5m18s

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2025-03-13 18:01:27 +03:00
parent 7893d763d1
commit 07a660fbc4
Signed by: dstepanov-yadro
GPG key ID: 237AF1A763293BC0
5 changed files with 27 additions and 1 deletions

View file

@ -3,6 +3,7 @@ package writecache
import (
"context"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/qos"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
"go.uber.org/zap"
)
@ -38,6 +39,8 @@ type options struct {
disableBackgroundFlush bool
// flushSizeLimit is total size of flushing objects.
flushSizeLimit uint64
// qosLimiter used to limit flush RPS.
qosLimiter qos.Limiter
}
// WithLogger sets logger.
@ -136,3 +139,9 @@ func WithFlushSizeLimit(v uint64) Option {
o.flushSizeLimit = v
}
}
func WithQoSLimiter(l qos.Limiter) Option {
return func(o *options) {
o.qosLimiter = l
}
}