[MM-55595] Use annotated logger in search layer (#25468)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5a4dba8809
Коммит
b2ec1ff8ae
@@ -11,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/public/shared/request"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/product"
|
||||
)
|
||||
@@ -94,6 +95,7 @@ type Store interface {
|
||||
CheckIntegrity() <-chan model.IntegrityCheckResult
|
||||
SetContext(context context.Context)
|
||||
Context() context.Context
|
||||
Logger() mlog.LoggerIFace
|
||||
NotifyAdmin() NotifyAdminStore
|
||||
PostPriority() PostPriorityStore
|
||||
PostAcknowledgement() PostAcknowledgementStore
|
||||
@@ -147,7 +149,7 @@ type TeamStore interface {
|
||||
AnalyticsTeamCount(opts *model.TeamSearch) (int64, error)
|
||||
SaveMultipleMembers(members []*model.TeamMember, maxUsersPerTeam int) ([]*model.TeamMember, error)
|
||||
SaveMember(member *model.TeamMember, maxUsersPerTeam int) (*model.TeamMember, error)
|
||||
UpdateMember(member *model.TeamMember) (*model.TeamMember, error)
|
||||
UpdateMember(rctx request.CTX, member *model.TeamMember) (*model.TeamMember, error)
|
||||
UpdateMultipleMembers(members []*model.TeamMember) ([]*model.TeamMember, error)
|
||||
GetMember(c request.CTX, teamID string, userID string) (*model.TeamMember, error)
|
||||
GetMembers(teamID string, offset int, limit int, teamMembersGetOptions *model.TeamMembersGetOptions) ([]*model.TeamMember, error)
|
||||
@@ -158,10 +160,10 @@ type TeamStore interface {
|
||||
GetTeamsForUserWithPagination(userID string, page, perPage int) ([]*model.TeamMember, error)
|
||||
GetChannelUnreadsForAllTeams(excludeTeamID, userID string) ([]*model.ChannelUnread, error)
|
||||
GetChannelUnreadsForTeam(teamID, userID string) ([]*model.ChannelUnread, error)
|
||||
RemoveMember(teamID string, userID string) error
|
||||
RemoveMembers(teamID string, userIds []string) error
|
||||
RemoveMember(rctx request.CTX, teamID string, userID string) error
|
||||
RemoveMembers(rctx request.CTX, teamID string, userIds []string) error
|
||||
RemoveAllMembersByTeam(teamID string) error
|
||||
RemoveAllMembersByUser(userID string) error
|
||||
RemoveAllMembersByUser(ctx request.CTX, userID string) error
|
||||
UpdateLastTeamIconUpdate(teamID string, curTime int64) error
|
||||
GetTeamsByScheme(schemeID string, offset int, limit int) ([]*model.Team, error)
|
||||
MigrateTeamMembers(fromTeamID string, fromUserID string) (map[string]string, error)
|
||||
@@ -191,9 +193,9 @@ type TeamStore interface {
|
||||
|
||||
type ChannelStore interface {
|
||||
Save(channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error)
|
||||
CreateDirectChannel(userID *model.User, otherUserID *model.User, channelOptions ...model.ChannelOption) (*model.Channel, error)
|
||||
SaveDirectChannel(channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) (*model.Channel, error)
|
||||
Update(channel *model.Channel) (*model.Channel, error)
|
||||
CreateDirectChannel(ctx request.CTX, userID *model.User, otherUserID *model.User, channelOptions ...model.ChannelOption) (*model.Channel, error)
|
||||
SaveDirectChannel(ctx request.CTX, channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) (*model.Channel, error)
|
||||
Update(ctx request.CTX, channel *model.Channel) (*model.Channel, error)
|
||||
UpdateSidebarChannelCategoryOnMove(channel *model.Channel, newTeamID string) error
|
||||
ClearSidebarOnTeamLeave(userID, teamID string) error
|
||||
Get(id string, allowFromCache bool) (*model.Channel, error)
|
||||
@@ -203,7 +205,7 @@ type ChannelStore interface {
|
||||
Delete(channelID string, timestamp int64) error
|
||||
Restore(channelID string, timestamp int64) error
|
||||
SetDeleteAt(channelID string, deleteAt int64, updateAt int64) error
|
||||
PermanentDelete(channelID string) error
|
||||
PermanentDelete(ctx request.CTX, channelID string) error
|
||||
PermanentDeleteByTeam(teamID string) error
|
||||
GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error)
|
||||
GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error)
|
||||
@@ -228,7 +230,7 @@ type ChannelStore interface {
|
||||
GetForPost(postID string) (*model.Channel, error)
|
||||
SaveMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error)
|
||||
SaveMember(member *model.ChannelMember) (*model.ChannelMember, error)
|
||||
UpdateMember(member *model.ChannelMember) (*model.ChannelMember, error)
|
||||
UpdateMember(ctx request.CTX, member *model.ChannelMember) (*model.ChannelMember, error)
|
||||
UpdateMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error)
|
||||
// UpdateMemberNotifyProps patches the notifyProps field with the given props map.
|
||||
// It replaces existing fields and creates new ones which don't exist.
|
||||
@@ -256,10 +258,10 @@ type ChannelStore interface {
|
||||
InvalidateGuestCount(channelID string)
|
||||
GetGuestCount(channelID string, allowFromCache bool) (int64, error)
|
||||
GetPinnedPosts(channelID string) (*model.PostList, error)
|
||||
RemoveMember(channelID string, userID string) error
|
||||
RemoveMembers(channelID string, userIds []string) error
|
||||
PermanentDeleteMembersByUser(userID string) error
|
||||
PermanentDeleteMembersByChannel(channelID string) error
|
||||
RemoveMember(ctx request.CTX, channelID string, userID string) error
|
||||
RemoveMembers(ctx request.CTX, channelID string, userIds []string) error
|
||||
PermanentDeleteMembersByUser(ctx request.CTX, userID string) error
|
||||
PermanentDeleteMembersByChannel(ctx request.CTX, channelID string) error
|
||||
UpdateLastViewedAt(channelIds []string, userID string) (map[string]int64, error)
|
||||
UpdateLastViewedAtPost(unreadPost *model.Post, userID string, mentionCount, mentionCountRoot, urgentMentionCount int, setUnreadCountRoot bool) (*model.ChannelUnreadAt, error)
|
||||
CountPostsAfter(channelID string, timestamp int64, excludedUserID string) (int, int, error)
|
||||
@@ -269,8 +271,8 @@ type ChannelStore interface {
|
||||
GetMembersForUser(teamID string, userID string) (model.ChannelMembers, error)
|
||||
GetTeamMembersForChannel(channelID string) ([]string, error)
|
||||
GetMembersForUserWithPagination(userID string, page, perPage int) (model.ChannelMembersWithTeamData, error)
|
||||
Autocomplete(userID, term string, includeDeleted, isGuest bool) (model.ChannelListWithTeamData, error)
|
||||
AutocompleteInTeam(teamID, userID, term string, includeDeleted, isGuest bool) (model.ChannelList, error)
|
||||
Autocomplete(rctx request.CTX, userID, term string, includeDeleted, isGuest bool) (model.ChannelListWithTeamData, error)
|
||||
AutocompleteInTeam(rctx request.CTX, teamID, userID, term string, includeDeleted, isGuest bool) (model.ChannelList, error)
|
||||
AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (model.ChannelList, error)
|
||||
SearchAllChannels(term string, opts ChannelSearchOpts) (model.ChannelListWithTeamData, int64, error)
|
||||
SearchInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error)
|
||||
@@ -305,7 +307,7 @@ type ChannelStore interface {
|
||||
GetAllChannelsForExportAfter(limit int, afterID string) ([]*model.ChannelForExport, error)
|
||||
GetAllDirectChannelsForExportAfter(limit int, afterID string) ([]*model.DirectChannelForExport, error)
|
||||
GetChannelMembersForExport(userID string, teamID string, includeArchivedChannel bool) ([]*model.ChannelMemberForExport, error)
|
||||
RemoveAllDeactivatedMembers(channelID string) error
|
||||
RemoveAllDeactivatedMembers(ctx request.CTX, channelID string) error
|
||||
GetChannelsBatchForIndexing(startTime int64, startChannelID string, limit int) ([]*model.Channel, error)
|
||||
UserBelongsToChannels(userID string, channelIds []string) (bool, error)
|
||||
|
||||
@@ -362,12 +364,12 @@ type ThreadStore interface {
|
||||
type PostStore interface {
|
||||
SaveMultiple(posts []*model.Post) ([]*model.Post, int, error)
|
||||
Save(post *model.Post) (*model.Post, error)
|
||||
Update(newPost *model.Post, oldPost *model.Post) (*model.Post, error)
|
||||
Update(rctx request.CTX, newPost *model.Post, oldPost *model.Post) (*model.Post, error)
|
||||
Get(ctx context.Context, id string, opts model.GetPostsOptions, userID string, sanitizeOptions map[string]bool) (*model.PostList, error)
|
||||
GetSingle(id string, inclDeleted bool) (*model.Post, error)
|
||||
Delete(postID string, timestamp int64, deleteByID string) error
|
||||
PermanentDeleteByUser(userID string) error
|
||||
PermanentDeleteByChannel(channelID string) error
|
||||
Delete(rctx request.CTX, postID string, timestamp int64, deleteByID string) error
|
||||
PermanentDeleteByUser(rctx request.CTX, userID string) error
|
||||
PermanentDeleteByChannel(rctx request.CTX, channelID string) error
|
||||
GetPosts(options model.GetPostsOptions, allowFromCache bool, sanitizeOptions map[string]bool) (*model.PostList, error)
|
||||
GetFlaggedPosts(userID string, offset int, limit int) (*model.PostList, error)
|
||||
// @openTracingParams userID, teamID, offset, limit
|
||||
@@ -388,7 +390,7 @@ type PostStore interface {
|
||||
ClearCaches()
|
||||
InvalidateLastPostTimeCache(channelID string)
|
||||
GetPostsCreatedAt(channelID string, timestamp int64) ([]*model.Post, error)
|
||||
Overwrite(post *model.Post) (*model.Post, error)
|
||||
Overwrite(rctx request.CTX, post *model.Post) (*model.Post, error)
|
||||
OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error)
|
||||
GetPostsByIds(postIds []string) ([]*model.Post, error)
|
||||
GetEditHistoryForPost(postId string) ([]*model.Post, error)
|
||||
@@ -400,7 +402,7 @@ type PostStore interface {
|
||||
GetParentsForExportAfter(limit int, afterID string, includeArchivedChannels bool) ([]*model.PostForExport, error)
|
||||
GetRepliesForExport(parentID string) ([]*model.ReplyForExport, error)
|
||||
GetDirectPostParentsForExportAfter(limit int, afterID string) ([]*model.DirectPostForExport, error)
|
||||
SearchPostsForUser(paramsList []*model.SearchParams, userID, teamID string, page, perPage int) (*model.PostSearchResults, error)
|
||||
SearchPostsForUser(rctx request.CTX, paramsList []*model.SearchParams, userID, teamID string, page, perPage int) (*model.PostSearchResults, error)
|
||||
GetOldestEntityCreationTime() (int64, error)
|
||||
HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error)
|
||||
GetPostsSinceForSync(options model.GetPostsSinceForSyncOptions, cursor model.GetPostsSinceForSyncCursor, limit int) ([]*model.Post, model.GetPostsSinceForSyncCursor, error)
|
||||
@@ -413,7 +415,7 @@ type PostStore interface {
|
||||
|
||||
type UserStore interface {
|
||||
Save(user *model.User) (*model.User, error)
|
||||
Update(user *model.User, allowRoleUpdate bool) (*model.UserUpdate, error)
|
||||
Update(rctx request.CTX, user *model.User, allowRoleUpdate bool) (*model.UserUpdate, error)
|
||||
UpdateNotifyProps(userID string, props map[string]string) error
|
||||
UpdateLastPictureUpdate(userID string) error
|
||||
ResetLastPictureUpdate(userID string) error
|
||||
@@ -462,7 +464,7 @@ type UserStore interface {
|
||||
GetAnyUnreadPostCountForChannel(userID string, channelID string) (int64, error)
|
||||
GetRecentlyActiveUsersForTeam(teamID string, offset, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error)
|
||||
GetNewUsersForTeam(teamID string, offset, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error)
|
||||
Search(teamID string, term string, options *model.UserSearchOptions) ([]*model.User, error)
|
||||
Search(rctx request.CTX, teamID string, term string, options *model.UserSearchOptions) ([]*model.User, error)
|
||||
SearchNotInTeam(notInTeamID string, term string, options *model.UserSearchOptions) ([]*model.User, error)
|
||||
SearchInChannel(channelID string, term string, options *model.UserSearchOptions) ([]*model.User, error)
|
||||
SearchNotInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) ([]*model.User, error)
|
||||
@@ -485,7 +487,7 @@ type UserStore interface {
|
||||
PromoteGuestToUser(userID string) error
|
||||
DemoteUserToGuest(userID string) (*model.User, error)
|
||||
DeactivateGuests() ([]string, error)
|
||||
AutocompleteUsersInChannel(teamID, channelID, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, error)
|
||||
AutocompleteUsersInChannel(rctx request.CTX, teamID, channelID, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, error)
|
||||
GetKnownUsers(userID string) ([]string, error)
|
||||
IsEmpty(excludeBots bool) (bool, error)
|
||||
GetUsersWithInvalidEmails(page int, perPage int, restrictedDomains string) ([]*model.User, error)
|
||||
@@ -706,8 +708,8 @@ type StatusStore interface {
|
||||
}
|
||||
|
||||
type FileInfoStore interface {
|
||||
Save(info *model.FileInfo) (*model.FileInfo, error)
|
||||
Upsert(info *model.FileInfo) (*model.FileInfo, error)
|
||||
Save(ctx request.CTX, info *model.FileInfo) (*model.FileInfo, error)
|
||||
Upsert(rctx request.CTX, info *model.FileInfo) (*model.FileInfo, error)
|
||||
Get(id string) (*model.FileInfo, error)
|
||||
GetFromMaster(id string) (*model.FileInfo, error)
|
||||
GetByIds(ids []string) ([]*model.FileInfo, error)
|
||||
@@ -716,13 +718,13 @@ type FileInfoStore interface {
|
||||
GetForUser(userID string) ([]*model.FileInfo, error)
|
||||
GetWithOptions(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, error)
|
||||
InvalidateFileInfosForPostCache(postID string, deleted bool)
|
||||
AttachToPost(fileID string, postID string, channelID, creatorID string) error
|
||||
DeleteForPost(postID string) (string, error)
|
||||
PermanentDelete(fileID string) error
|
||||
PermanentDeleteBatch(endTime int64, limit int64) (int64, error)
|
||||
PermanentDeleteByUser(userID string) (int64, error)
|
||||
SetContent(fileID, content string) error
|
||||
Search(paramsList []*model.SearchParams, userID, teamID string, page, perPage int) (*model.FileInfoList, error)
|
||||
AttachToPost(c request.CTX, fileID string, postID string, channelID, creatorID string) error
|
||||
DeleteForPost(c request.CTX, postID string) (string, error)
|
||||
PermanentDelete(c request.CTX, fileID string) error
|
||||
PermanentDeleteBatch(ctx request.CTX, endTime int64, limit int64) (int64, error)
|
||||
PermanentDeleteByUser(ctx request.CTX, userID string) (int64, error)
|
||||
SetContent(ctx request.CTX, fileID, content string) error
|
||||
Search(ctx request.CTX, paramsList []*model.SearchParams, userID, teamID string, page, perPage int) (*model.FileInfoList, error)
|
||||
CountAll() (int64, error)
|
||||
GetFilesBatchForIndexing(startTime int64, startFileID string, includeDeleted bool, limit int) ([]*model.FileForIndexing, error)
|
||||
ClearCaches()
|
||||
|
||||
Ссылка в новой задаче
Block a user