MM-21357: Use typed constants ClusterEvent (#17920)

* MM-21357: Use typed constants ClusterEvent

Use typed constants for:
- model.ClusterEvent

https://mattermost.atlassian.net/browse/MM-21357

```release-note
Use typed constant for model.ClusterEvent
```

* trigger CI
```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2021-07-15 11:02:17 +05:30
коммит произвёл Claudio Costa
родитель 9ae45d55d9
Коммит 623f8dc9af
14 изменённых файлов: 61 добавлений и 49 удалений

Просмотреть файл

@@ -12,7 +12,7 @@ type ClusterMessageHandler func(msg *model.ClusterMessage)
type ClusterInterface interface {
StartInterNodeCommunication()
StopInterNodeCommunication()
RegisterClusterMessageHandler(event string, crm ClusterMessageHandler)
RegisterClusterMessageHandler(event model.ClusterEvent, crm ClusterMessageHandler)
GetClusterId() string
IsLeader() bool
// HealthScore returns a number which is indicative of how well an instance is meeting

Просмотреть файл

@@ -5,6 +5,7 @@ package einterfaces
import (
"github.com/mattermost/logr"
"github.com/mattermost/mattermost-server/v5/model"
)
type MetricsInterface interface {
@@ -22,7 +23,7 @@ type MetricsInterface interface {
IncrementClusterRequest()
ObserveClusterRequestDuration(elapsed float64)
IncrementClusterEventType(eventType string)
IncrementClusterEventType(eventType model.ClusterEvent)
IncrementLogin()
IncrementLoginFail()

Просмотреть файл

@@ -187,7 +187,7 @@ func (_m *ClusterInterface) NotifyMsg(buf []byte) {
}
// RegisterClusterMessageHandler provides a mock function with given fields: event, crm
func (_m *ClusterInterface) RegisterClusterMessageHandler(event string, crm einterfaces.ClusterMessageHandler) {
func (_m *ClusterInterface) RegisterClusterMessageHandler(event model.ClusterEvent, crm einterfaces.ClusterMessageHandler) {
_m.Called(event, crm)
}

Просмотреть файл

@@ -7,6 +7,8 @@ package mocks
import (
logr "github.com/mattermost/logr"
mock "github.com/stretchr/testify/mock"
model "github.com/mattermost/mattermost-server/v5/model"
)
// MetricsInterface is an autogenerated mock type for the MetricsInterface type
@@ -61,7 +63,7 @@ func (_m *MetricsInterface) IncrementChannelIndexCounter() {
}
// IncrementClusterEventType provides a mock function with given fields: eventType
func (_m *MetricsInterface) IncrementClusterEventType(eventType string) {
func (_m *MetricsInterface) IncrementClusterEventType(eventType model.ClusterEvent) {
_m.Called(eventType)
}