[#xx] engine: Rename rebuildLimiter
to routineLimiter
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
273980cfb9
commit
80af71db44
2 changed files with 7 additions and 7 deletions
|
@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue