mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Migrate Groups to not use the Layered store (#10946)
This commit is contained in:
committed by
George Goldberg
parent
78b525df89
commit
bb2e52ee68
@@ -24,7 +24,6 @@ const (
|
||||
CLUSTER_EVENT_CLEAR_SESSION_CACHE_FOR_USER = "clear_session_user"
|
||||
CLUSTER_EVENT_INVALIDATE_CACHE_FOR_ROLES = "inv_roles"
|
||||
CLUSTER_EVENT_INVALIDATE_CACHE_FOR_SCHEMES = "inv_schemes"
|
||||
CLUSTER_EVENT_INVALIDATE_CACHE_FOR_GROUPS = "inv_groups"
|
||||
|
||||
CLUSTER_SEND_BEST_EFFORT = "best_effort"
|
||||
CLUSTER_SEND_RELIABLE = "reliable"
|
||||
|
||||
@@ -29,7 +29,6 @@ type LayeredStore struct {
|
||||
LocalCacheLayer *LocalCacheSupplier
|
||||
RedisLayer *RedisSupplier
|
||||
LayerChainHead LayeredStoreSupplier
|
||||
GroupStore GroupStore
|
||||
}
|
||||
|
||||
func NewLayeredStore(db LayeredStoreDatabaseLayer, metrics einterfaces.MetricsInterface, cluster einterfaces.ClusterInterface) Store {
|
||||
@@ -42,7 +41,6 @@ func NewLayeredStore(db LayeredStoreDatabaseLayer, metrics einterfaces.MetricsIn
|
||||
store.ReactionStore = &LayeredReactionStore{store}
|
||||
store.RoleStore = &LayeredRoleStore{store}
|
||||
store.SchemeStore = &LayeredSchemeStore{store}
|
||||
store.GroupStore = &LayeredGroupStore{store}
|
||||
|
||||
// Setup the chain
|
||||
if ENABLE_EXPERIMENTAL_REDIS {
|
||||
@@ -188,7 +186,7 @@ func (s *LayeredStore) Scheme() SchemeStore {
|
||||
}
|
||||
|
||||
func (s *LayeredStore) Group() GroupStore {
|
||||
return s.GroupStore
|
||||
return s.DatabaseLayer.Group()
|
||||
}
|
||||
|
||||
func (s *LayeredStore) LinkMetadata() LinkMetadataStore {
|
||||
@@ -327,157 +325,3 @@ func (s *LayeredSchemeStore) PermanentDeleteAll() StoreChannel {
|
||||
return supplier.SchemePermanentDeleteAll(s.TmpContext)
|
||||
})
|
||||
}
|
||||
|
||||
type LayeredGroupStore struct {
|
||||
*LayeredStore
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) Create(group *model.Group) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupCreate(s.TmpContext, group)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) Get(groupID string) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupGet(s.TmpContext, groupID)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupGetByRemoteID(s.TmpContext, remoteID, groupSource)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) GetAllBySource(groupSource model.GroupSource) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupGetAllBySource(s.TmpContext, groupSource)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) Update(group *model.Group) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupUpdate(s.TmpContext, group)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) Delete(groupID string) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupDelete(s.TmpContext, groupID)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) GetMemberUsers(groupID string) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupGetMemberUsers(s.TmpContext, groupID)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) GetMemberUsersPage(groupID string, offset int, limit int) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupGetMemberUsersPage(s.TmpContext, groupID, offset, limit)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) GetMemberCount(groupID string) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupGetMemberCount(s.TmpContext, groupID)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) CreateOrRestoreMember(groupID string, userID string) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupCreateOrRestoreMember(s.TmpContext, groupID, userID)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) DeleteMember(groupID string, userID string) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupDeleteMember(s.TmpContext, groupID, userID)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupCreateGroupSyncable(s.TmpContext, groupSyncable)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupGetGroupSyncable(s.TmpContext, groupID, syncableID, syncableType)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupGetAllGroupSyncablesByGroup(s.TmpContext, groupID, syncableType)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupUpdateGroupSyncable(s.TmpContext, groupSyncable)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GroupDeleteGroupSyncable(s.TmpContext, groupID, syncableID, syncableType)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) TeamMembersToAdd(since int64) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.TeamMembersToAdd(s.TmpContext, since)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) ChannelMembersToAdd(since int64) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.ChannelMembersToAdd(s.TmpContext, since)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) TeamMembersToRemove() StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.TeamMembersToRemove(s.TmpContext)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) ChannelMembersToRemove() StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.ChannelMembersToRemove(s.TmpContext)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GetGroupsByChannel(s.TmpContext, channelId, opts)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) CountGroupsByChannel(channelId string, opts model.GroupSearchOpts) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.CountGroupsByChannel(s.TmpContext, channelId, opts)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GetGroupsByTeam(s.TmpContext, teamId, opts)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) CountGroupsByTeam(teamId string, opts model.GroupSearchOpts) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.CountGroupsByTeam(s.TmpContext, teamId, opts)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *LayeredGroupStore) GetGroups(page, perPage int, opts model.GroupSearchOpts) StoreChannel {
|
||||
return s.RunQuery(func(supplier LayeredStoreSupplier) *LayeredStoreSupplierResult {
|
||||
return supplier.GetGroups(s.TmpContext, page, perPage, opts)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -47,38 +47,4 @@ type LayeredStoreSupplier interface {
|
||||
SchemeDelete(ctx context.Context, schemeId string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
SchemeGetAllPage(ctx context.Context, scope string, offset int, limit int, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
SchemePermanentDeleteAll(ctx context.Context, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
|
||||
// Groups
|
||||
GroupCreate(ctx context.Context, group *model.Group, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupGet(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupGetByRemoteID(ctx context.Context, remoteID string, groupSource model.GroupSource, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupGetAllBySource(ctx context.Context, groupSource model.GroupSource, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupUpdate(ctx context.Context, group *model.Group, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupDelete(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
|
||||
GroupGetMemberUsers(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupGetMemberUsersPage(ctx context.Context, groupID string, offset int, limit int, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupGetMemberCount(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupCreateOrRestoreMember(ctx context.Context, groupID string, userID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupDeleteMember(ctx context.Context, groupID string, userID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
|
||||
GroupCreateGroupSyncable(ctx context.Context, groupSyncable *model.GroupSyncable, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupGetGroupSyncable(ctx context.Context, groupID string, syncableID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupGetAllGroupSyncablesByGroup(ctx context.Context, groupID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupUpdateGroupSyncable(ctx context.Context, groupSyncable *model.GroupSyncable, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
GroupDeleteGroupSyncable(ctx context.Context, groupID string, syncableID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
|
||||
TeamMembersToAdd(ctx context.Context, since int64, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
ChannelMembersToAdd(ctx context.Context, since int64, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
|
||||
TeamMembersToRemove(ctx context.Context, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
ChannelMembersToRemove(ctx context.Context, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
|
||||
GetGroupsByChannel(ctx context.Context, channelId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
CountGroupsByChannel(ctx context.Context, channelId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
|
||||
GetGroupsByTeam(ctx context.Context, teamId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
CountGroupsByTeam(ctx context.Context, teamId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
|
||||
GetGroups(ctx context.Context, page, perPage int, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ type LocalCacheSupplier struct {
|
||||
schemeCache *utils.Cache
|
||||
metrics einterfaces.MetricsInterface
|
||||
cluster einterfaces.ClusterInterface
|
||||
groupCache *utils.Cache
|
||||
}
|
||||
|
||||
// Caching Interface
|
||||
@@ -54,7 +53,6 @@ func NewLocalCacheSupplier(metrics einterfaces.MetricsInterface, cluster einterf
|
||||
reactionCache: utils.NewLruWithParams(REACTION_CACHE_SIZE, "Reaction", REACTION_CACHE_SEC, model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_REACTIONS),
|
||||
roleCache: utils.NewLruWithParams(ROLE_CACHE_SIZE, "Role", ROLE_CACHE_SEC, model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_ROLES),
|
||||
schemeCache: utils.NewLruWithParams(SCHEME_CACHE_SIZE, "Scheme", SCHEME_CACHE_SEC, model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_SCHEMES),
|
||||
groupCache: utils.NewLruWithParams(GROUP_CACHE_SIZE, "Group", GROUP_CACHE_SEC, model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_GROUPS),
|
||||
metrics: metrics,
|
||||
cluster: cluster,
|
||||
}
|
||||
@@ -62,7 +60,6 @@ func NewLocalCacheSupplier(metrics einterfaces.MetricsInterface, cluster einterf
|
||||
if cluster != nil {
|
||||
cluster.RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_REACTIONS, supplier.handleClusterInvalidateReaction)
|
||||
cluster.RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_ROLES, supplier.handleClusterInvalidateRole)
|
||||
cluster.RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_GROUPS, supplier.handleClusterInvalidateGroup)
|
||||
}
|
||||
|
||||
return supplier
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
// Copyright (c) 2018-present Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
)
|
||||
|
||||
func (s *LocalCacheSupplier) handleClusterInvalidateGroup(msg *model.ClusterMessage) {
|
||||
if msg.Data == CLEAR_CACHE_MESSAGE_DATA {
|
||||
s.groupCache.Purge()
|
||||
} else {
|
||||
s.groupCache.Remove(msg.Data)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupCreate(ctx context.Context, group *model.Group, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupCreate(ctx, group, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupGet(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
if result := s.doStandardReadCache(ctx, s.groupCache, groupID, hints...); result != nil {
|
||||
return result
|
||||
}
|
||||
|
||||
result := s.Next().GroupGet(ctx, groupID, hints...)
|
||||
|
||||
s.doStandardAddToCache(ctx, s.groupCache, groupID, result, hints...)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupGetByRemoteID(ctx context.Context, remoteID string, groupSource model.GroupSource, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupGetByRemoteID(ctx, remoteID, groupSource, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupGetAllBySource(ctx context.Context, groupSource model.GroupSource, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupGetAllBySource(ctx, groupSource, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupUpdate(ctx context.Context, group *model.Group, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
defer s.doInvalidateCacheCluster(s.groupCache, group.Id)
|
||||
return s.Next().GroupUpdate(ctx, group, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupDelete(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
defer s.doInvalidateCacheCluster(s.groupCache, groupID)
|
||||
defer s.doClearCacheCluster(s.groupCache)
|
||||
|
||||
return s.Next().GroupDelete(ctx, groupID, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupGetMemberUsers(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupGetMemberUsers(ctx, groupID, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupGetMemberUsersPage(ctx context.Context, groupID string, offset int, limit int, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupGetMemberUsersPage(ctx, groupID, offset, limit, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupGetMemberCount(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupGetMemberCount(ctx, groupID, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupCreateOrRestoreMember(ctx context.Context, groupID string, userID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupCreateOrRestoreMember(ctx, groupID, userID, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupDeleteMember(ctx context.Context, groupID string, userID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupDeleteMember(ctx, groupID, userID, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupCreateGroupSyncable(ctx context.Context, groupSyncable *model.GroupSyncable, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupCreateGroupSyncable(ctx, groupSyncable, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupGetGroupSyncable(ctx context.Context, groupID string, syncableID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupGetGroupSyncable(ctx, groupID, syncableID, syncableType, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupGetAllGroupSyncablesByGroup(ctx context.Context, groupID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupGetAllGroupSyncablesByGroup(ctx, groupID, syncableType, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupUpdateGroupSyncable(ctx context.Context, groupSyncable *model.GroupSyncable, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupUpdateGroupSyncable(ctx, groupSyncable, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GroupDeleteGroupSyncable(ctx context.Context, groupID string, syncableID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GroupDeleteGroupSyncable(ctx, groupID, syncableID, syncableType, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) TeamMembersToAdd(ctx context.Context, since int64, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().TeamMembersToAdd(ctx, since, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) ChannelMembersToAdd(ctx context.Context, since int64, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().ChannelMembersToAdd(ctx, since, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) TeamMembersToRemove(ctx context.Context, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().TeamMembersToRemove(ctx, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) ChannelMembersToRemove(ctx context.Context, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().ChannelMembersToRemove(ctx, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GetGroupsByChannel(ctx context.Context, channelId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GetGroupsByChannel(ctx, channelId, opts, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) CountGroupsByChannel(ctx context.Context, channelId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().CountGroupsByChannel(ctx, channelId, opts, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GetGroupsByTeam(ctx context.Context, teamId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GetGroupsByTeam(ctx, teamId, opts, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) CountGroupsByTeam(ctx context.Context, teamId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().CountGroupsByTeam(ctx, teamId, opts, hints...)
|
||||
}
|
||||
|
||||
func (s *LocalCacheSupplier) GetGroups(ctx context.Context, page, perPage int, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
return s.Next().GetGroups(ctx, page, perPage, opts, hints...)
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
// Copyright (c) 2018-present Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
)
|
||||
|
||||
func (s *RedisSupplier) GroupCreate(ctx context.Context, group *model.Group, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupCreate(ctx, group, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupGet(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupGet(ctx, groupID, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupGetByRemoteID(ctx context.Context, remoteID string, groupSource model.GroupSource, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupGetByRemoteID(ctx, remoteID, groupSource, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupGetAllBySource(ctx context.Context, groupSource model.GroupSource, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupGetAllBySource(ctx, groupSource, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupUpdate(ctx context.Context, group *model.Group, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupUpdate(ctx, group, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupDelete(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupDelete(ctx, groupID, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupGetMemberUsers(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupGetMemberUsers(ctx, groupID, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupGetMemberUsersPage(ctx context.Context, groupID string, offset int, limit int, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupGetMemberUsersPage(ctx, groupID, offset, limit, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupGetMemberCount(ctx context.Context, groupID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupGetMemberCount(ctx, groupID, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupCreateOrRestoreMember(ctx context.Context, groupID string, userID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupCreateOrRestoreMember(ctx, groupID, userID, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupDeleteMember(ctx context.Context, groupID string, userID string, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupDeleteMember(ctx, groupID, userID, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupCreateGroupSyncable(ctx context.Context, groupSyncable *model.GroupSyncable, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupCreateGroupSyncable(ctx, groupSyncable, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupGetGroupSyncable(ctx context.Context, groupID string, syncableID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupGetGroupSyncable(ctx, groupID, syncableID, syncableType, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupGetAllGroupSyncablesByGroup(ctx context.Context, groupID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupGetAllGroupSyncablesByGroup(ctx, groupID, syncableType, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupUpdateGroupSyncable(ctx context.Context, groupSyncable *model.GroupSyncable, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupUpdateGroupSyncable(ctx, groupSyncable, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GroupDeleteGroupSyncable(ctx context.Context, groupID string, syncableID string, syncableType model.GroupSyncableType, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GroupDeleteGroupSyncable(ctx, groupID, syncableID, syncableType, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) TeamMembersToAdd(ctx context.Context, since int64, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().TeamMembersToAdd(ctx, since, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) ChannelMembersToAdd(ctx context.Context, since int64, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().ChannelMembersToAdd(ctx, since, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) TeamMembersToRemove(ctx context.Context, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().TeamMembersToRemove(ctx, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) ChannelMembersToRemove(ctx context.Context, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().ChannelMembersToRemove(ctx, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GetGroupsByChannel(ctx context.Context, channelId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GetGroupsByChannel(ctx, channelId, opts, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) CountGroupsByChannel(ctx context.Context, channelId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().CountGroupsByChannel(ctx, channelId, opts, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GetGroupsByTeam(ctx context.Context, teamId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GetGroupsByTeam(ctx, teamId, opts, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) CountGroupsByTeam(ctx context.Context, teamId string, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().CountGroupsByTeam(ctx, teamId, opts, hints...)
|
||||
}
|
||||
|
||||
func (s *RedisSupplier) GetGroups(ctx context.Context, page, perPage int, opts model.GroupSearchOpts, hints ...LayeredStoreHint) *LayeredStoreSupplierResult {
|
||||
// TODO: Redis caching.
|
||||
return s.Next().GetGroups(ctx, page, perPage, opts, hints...)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -151,11 +151,11 @@ func NewSqlSupplier(settings model.SqlSettings, metrics einterfaces.MetricsInter
|
||||
supplier.oldStores.TermsOfService = NewSqlTermsOfServiceStore(supplier, metrics)
|
||||
supplier.oldStores.UserTermsOfService = NewSqlUserTermsOfServiceStore(supplier)
|
||||
supplier.oldStores.linkMetadata = NewSqlLinkMetadataStore(supplier)
|
||||
supplier.oldStores.group = NewSqlGroupStore(supplier)
|
||||
|
||||
initSqlSupplierReactions(supplier)
|
||||
initSqlSupplierRoles(supplier)
|
||||
initSqlSupplierSchemes(supplier)
|
||||
initSqlSupplierGroups(supplier)
|
||||
|
||||
err := supplier.GetMaster().CreateTablesIfNotExists()
|
||||
if err != nil {
|
||||
@@ -196,8 +196,7 @@ func NewSqlSupplier(settings model.SqlSettings, metrics einterfaces.MetricsInter
|
||||
supplier.oldStores.TermsOfService.(SqlTermsOfServiceStore).CreateIndexesIfNotExists()
|
||||
supplier.oldStores.UserTermsOfService.(SqlUserTermsOfServiceStore).CreateIndexesIfNotExists()
|
||||
supplier.oldStores.linkMetadata.(*SqlLinkMetadataStore).CreateIndexesIfNotExists()
|
||||
|
||||
supplier.CreateIndexesIfNotExistsGroups()
|
||||
supplier.oldStores.group.(*SqlGroupStore).CreateIndexesIfNotExists()
|
||||
|
||||
supplier.oldStores.preference.(*SqlPreferenceStore).DeleteUnusedFeatures()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user