github.com/rifflearning/mattermost-server@v5.11.1+incompatible/testlib/cluster.go (about) 1 // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package testlib 5 6 import ( 7 "github.com/mattermost/mattermost-server/einterfaces" 8 "github.com/mattermost/mattermost-server/model" 9 ) 10 11 type FakeClusterInterface struct { 12 clusterMessageHandler einterfaces.ClusterMessageHandler 13 } 14 15 func (c *FakeClusterInterface) StartInterNodeCommunication() {} 16 17 func (c *FakeClusterInterface) StopInterNodeCommunication() {} 18 19 func (c *FakeClusterInterface) RegisterClusterMessageHandler(event string, crm einterfaces.ClusterMessageHandler) { 20 c.clusterMessageHandler = crm 21 } 22 23 func (c *FakeClusterInterface) GetClusterId() string { return "" } 24 25 func (c *FakeClusterInterface) IsLeader() bool { return false } 26 27 func (c *FakeClusterInterface) GetMyClusterInfo() *model.ClusterInfo { return nil } 28 29 func (c *FakeClusterInterface) GetClusterInfos() []*model.ClusterInfo { return nil } 30 31 func (c *FakeClusterInterface) SendClusterMessage(cluster *model.ClusterMessage) {} 32 33 func (c *FakeClusterInterface) NotifyMsg(buf []byte) {} 34 35 func (c *FakeClusterInterface) GetClusterStats() ([]*model.ClusterStats, *model.AppError) { 36 return nil, nil 37 } 38 39 func (c *FakeClusterInterface) GetLogs(page, perPage int) ([]string, *model.AppError) { 40 return []string{}, nil 41 } 42 43 func (c *FakeClusterInterface) ConfigChanged(previousConfig *model.Config, newConfig *model.Config, sendToOtherServer bool) *model.AppError { 44 return nil 45 } 46 47 func (c *FakeClusterInterface) SendClearRoleCacheMessage() { 48 c.clusterMessageHandler(&model.ClusterMessage{ 49 Event: model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_ROLES, 50 }) 51 } 52 53 func (c *FakeClusterInterface) GetPluginStatuses() (model.PluginStatuses, *model.AppError) { 54 return nil, nil 55 }