forked from mattermost/mattermost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster_handlers.go
77 lines (60 loc) · 3.74 KB
/
cluster_handlers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package app
import (
"strings"
"github.com/mattermost/platform/einterfaces"
"github.com/mattermost/platform/model"
)
func RegisterAllClusterMessageHandlers() {
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_PUBLISH, ClusterPublishHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_UPDATE_STATUS, ClusterUpdateStatusHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_ALL_CACHES, ClusterInvalidateAllCachesHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_REACTIONS, ClusterInvalidateCacheForReactionsHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_WEBHOOK, ClusterInvalidateCacheForWebhookHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_POSTS, ClusterInvalidateCacheForChannelPostsHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_MEMBERS_NOTIFY_PROPS, ClusterInvalidateCacheForChannelMembersNotifyPropHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_MEMBERS, ClusterInvalidateCacheForChannelMembersHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_BY_NAME, ClusterInvalidateCacheForChannelByNameHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL, ClusterInvalidateCacheForChannelHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_USER, ClusterInvalidateCacheForUserHandler)
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_CLEAR_SESSION_CACHE_FOR_USER, ClusterClearSessionCacheForUserHandler)
}
func ClusterPublishHandler(msg *model.ClusterMessage) {
event := model.WebSocketEventFromJson(strings.NewReader(msg.Data))
PublishSkipClusterSend(event)
}
func ClusterUpdateStatusHandler(msg *model.ClusterMessage) {
status := model.StatusFromJson(strings.NewReader(msg.Data))
AddStatusCacheSkipClusterSend(status)
}
func ClusterInvalidateAllCachesHandler(msg *model.ClusterMessage) {
InvalidateAllCachesSkipSend()
}
func ClusterInvalidateCacheForReactionsHandler(msg *model.ClusterMessage) {
InvalidateCacheForReactionsSkipClusterSend(msg.Data)
}
func ClusterInvalidateCacheForWebhookHandler(msg *model.ClusterMessage) {
InvalidateCacheForWebhookSkipClusterSend(msg.Data)
}
func ClusterInvalidateCacheForChannelPostsHandler(msg *model.ClusterMessage) {
InvalidateCacheForChannelPostsSkipClusterSend(msg.Data)
}
func ClusterInvalidateCacheForChannelMembersNotifyPropHandler(msg *model.ClusterMessage) {
InvalidateCacheForChannelMembersNotifyPropsSkipClusterSend(msg.Data)
}
func ClusterInvalidateCacheForChannelMembersHandler(msg *model.ClusterMessage) {
InvalidateCacheForChannelMembersSkipClusterSend(msg.Data)
}
func ClusterInvalidateCacheForChannelByNameHandler(msg *model.ClusterMessage) {
InvalidateCacheForChannelByNameSkipClusterSend(msg.Props["id"], msg.Props["name"])
}
func ClusterInvalidateCacheForChannelHandler(msg *model.ClusterMessage) {
InvalidateCacheForChannelSkipClusterSend(msg.Data)
}
func ClusterInvalidateCacheForUserHandler(msg *model.ClusterMessage) {
InvalidateCacheForUserSkipClusterSend(msg.Data)
}
func ClusterClearSessionCacheForUserHandler(msg *model.ClusterMessage) {
ClearSessionCacheForUserSkipClusterSend(msg.Data)
}