[#xx] engine: Rename rebuildLimiter to routineLimiter

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2024-09-04 11:51:52 +03:00
parent 273980cfb9
commit 80af71db44
2 changed files with 7 additions and 7 deletions

View file

@ -40,7 +40,7 @@ type StorageEngine struct {
err error
}
evacuateLimiter *evacuationLimiter
rebuildLimiter *rebuildLimiter
rebuildLimiter *routineLimiter
}
type shardWrapper struct {
@ -243,7 +243,7 @@ func New(opts ...Option) *StorageEngine {
closeCh: make(chan struct{}),
setModeCh: make(chan setModeRequest),
evacuateLimiter: &evacuationLimiter{},
rebuildLimiter: newRebuildLimiter(c.rebuildWorkersCount),
rebuildLimiter: newRoutineLimiter(c.rebuildWorkersCount),
}
}

View file

@ -2,17 +2,17 @@ package engine
import "context"
type rebuildLimiter struct {
type routineLimiter struct {
semaphore chan struct{}
}
func newRebuildLimiter(workersCount uint32) *rebuildLimiter {
return &rebuildLimiter{
func newRoutineLimiter(workersCount uint32) *routineLimiter {
return &routineLimiter{
semaphore: make(chan struct{}, workersCount),
}
}
func (l *rebuildLimiter) AcquireWorkSlot(ctx context.Context) error {
func (l *routineLimiter) AcquireWorkSlot(ctx context.Context) error {
select {
case l.semaphore <- struct{}{}:
return nil
@ -21,6 +21,6 @@ func (l *rebuildLimiter) AcquireWorkSlot(ctx context.Context) error {
}
}
func (l *rebuildLimiter) ReleaseWorkSlot() {
func (l *routineLimiter) ReleaseWorkSlot() {
<-l.semaphore
}