Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 committed Sep 23, 2024
1 parent 30563b7 commit 419be30
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
11 changes: 11 additions & 0 deletions pkg/core/constant/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,14 @@ const (
// Out indicates that the direction is out.
Out
)

func (d Direction) String() string {
switch d {
case In:
return "in"
case Out:
return "out"
default:
return "unknown"

Check warning on line 176 in pkg/core/constant/kind.go

View check run for this annotation

Codecov / codecov/patch

pkg/core/constant/kind.go#L169-L176

Added lines #L169 - L176 were not covered by tests
}
}
4 changes: 2 additions & 2 deletions pkg/core/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ func (s *StoresInfo) PauseLeaderTransfer(storeID uint64, direction constant.Dire
return nil
}

// ResumeLeaderTransferIn cleans a store's pause state. The store can be selected
// as target of TransferLeader again.
// ResumeLeaderTransfer cleans a store's pause state. The store can be selected
// as source or target of TransferLeader again.
func (s *StoresInfo) ResumeLeaderTransfer(storeID uint64, direction constant.Direction) {
s.Lock()
defer s.Unlock()
Expand Down
14 changes: 0 additions & 14 deletions pkg/core/store_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,6 @@ func ResumeLeaderTransfer(d constant.Direction) StoreCreateOption {
}
}

// PauseLeaderTransferOut prevents the store from been selected as source store of TransferLeader.
func PauseLeaderTransferOut() StoreCreateOption {
return func(store *StoreInfo) {
store.pauseLeaderTransferOut = true
}
}

// ResumeLeaderTransferOut cleans a store's pause state. The store can be selected as source of TransferLeader again.
func ResumeLeaderTransferOut() StoreCreateOption {
return func(store *StoreInfo) {
store.pauseLeaderTransferOut = false
}
}

// SlowStoreEvicted marks a store as a slow store and prevents transferring
// leader to the store
func SlowStoreEvicted() StoreCreateOption {
Expand Down
2 changes: 1 addition & 1 deletion pkg/schedule/schedulers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func pauseAndResumeLeaderTransfer[T any](cluster *core.BasicCluster, direction c
continue
}
if err := cluster.PauseLeaderTransfer(id, direction); err != nil {
log.Error("pause leader transfer in failed", zap.Uint64("store-id", id), errs.ZapError(err))
log.Error("pause leader transfer failed", zap.Uint64("store-id", id), zap.String("direction", direction.String()), errs.ZapError(err))

Check warning on line 407 in pkg/schedule/schedulers/utils.go

View check run for this annotation

Codecov / codecov/patch

pkg/schedule/schedulers/utils.go#L407

Added line #L407 was not covered by tests
}
}
}

0 comments on commit 419be30

Please sign in to comment.