github.com/mad-app/mattermost-server@v5.11.1+incompatible/store/store.go (about)

     1  // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package store
     5  
     6  import (
     7  	"time"
     8  
     9  	"github.com/mattermost/mattermost-server/model"
    10  )
    11  
    12  type StoreResult struct {
    13  	Data interface{}
    14  	Err  *model.AppError
    15  }
    16  
    17  type StoreChannel chan StoreResult
    18  
    19  func Do(f func(result *StoreResult)) StoreChannel {
    20  	storeChannel := make(StoreChannel, 1)
    21  	go func() {
    22  		result := StoreResult{}
    23  		f(&result)
    24  		storeChannel <- result
    25  		close(storeChannel)
    26  	}()
    27  	return storeChannel
    28  }
    29  
    30  func Must(sc StoreChannel) interface{} {
    31  	r := <-sc
    32  	if r.Err != nil {
    33  
    34  		time.Sleep(time.Second)
    35  		panic(r.Err)
    36  	}
    37  
    38  	return r.Data
    39  }
    40  
    41  type Store interface {
    42  	Team() TeamStore
    43  	Channel() ChannelStore
    44  	Post() PostStore
    45  	User() UserStore
    46  	Bot() BotStore
    47  	Audit() AuditStore
    48  	ClusterDiscovery() ClusterDiscoveryStore
    49  	Compliance() ComplianceStore
    50  	Session() SessionStore
    51  	OAuth() OAuthStore
    52  	System() SystemStore
    53  	Webhook() WebhookStore
    54  	Command() CommandStore
    55  	CommandWebhook() CommandWebhookStore
    56  	Preference() PreferenceStore
    57  	License() LicenseStore
    58  	Token() TokenStore
    59  	Emoji() EmojiStore
    60  	Status() StatusStore
    61  	FileInfo() FileInfoStore
    62  	Reaction() ReactionStore
    63  	Role() RoleStore
    64  	Scheme() SchemeStore
    65  	Job() JobStore
    66  	UserAccessToken() UserAccessTokenStore
    67  	ChannelMemberHistory() ChannelMemberHistoryStore
    68  	Plugin() PluginStore
    69  	TermsOfService() TermsOfServiceStore
    70  	Group() GroupStore
    71  	UserTermsOfService() UserTermsOfServiceStore
    72  	LinkMetadata() LinkMetadataStore
    73  	MarkSystemRanUnitTests()
    74  	Close()
    75  	LockToMaster()
    76  	UnlockFromMaster()
    77  	DropAllTables()
    78  	TotalMasterDbConnections() int
    79  	TotalReadDbConnections() int
    80  	TotalSearchDbConnections() int
    81  }
    82  
    83  type TeamStore interface {
    84  	Save(team *model.Team) StoreChannel
    85  	Update(team *model.Team) StoreChannel
    86  	UpdateDisplayName(name string, teamId string) StoreChannel
    87  	Get(id string) StoreChannel
    88  	GetByName(name string) StoreChannel
    89  	SearchByName(name string) StoreChannel
    90  	SearchAll(term string) StoreChannel
    91  	SearchOpen(term string) StoreChannel
    92  	SearchPrivate(term string) StoreChannel
    93  	GetAll() StoreChannel
    94  	GetAllPage(offset int, limit int) StoreChannel
    95  	GetAllPrivateTeamListing() StoreChannel
    96  	GetAllPrivateTeamPageListing(offset int, limit int) StoreChannel
    97  	GetAllTeamListing() StoreChannel
    98  	GetAllTeamPageListing(offset int, limit int) StoreChannel
    99  	GetTeamsByUserId(userId string) StoreChannel
   100  	GetByInviteId(inviteId string) StoreChannel
   101  	PermanentDelete(teamId string) StoreChannel
   102  	AnalyticsTeamCount() StoreChannel
   103  	SaveMember(member *model.TeamMember, maxUsersPerTeam int) StoreChannel
   104  	UpdateMember(member *model.TeamMember) StoreChannel
   105  	GetMember(teamId string, userId string) StoreChannel
   106  	GetMembers(teamId string, offset int, limit int) StoreChannel
   107  	GetMembersByIds(teamId string, userIds []string) StoreChannel
   108  	GetTotalMemberCount(teamId string) StoreChannel
   109  	GetActiveMemberCount(teamId string) StoreChannel
   110  	GetTeamsForUser(userId string) StoreChannel
   111  	GetTeamsForUserWithPagination(userId string, page, perPage int) StoreChannel
   112  	GetChannelUnreadsForAllTeams(excludeTeamId, userId string) StoreChannel
   113  	GetChannelUnreadsForTeam(teamId, userId string) StoreChannel
   114  	RemoveMember(teamId string, userId string) StoreChannel
   115  	RemoveAllMembersByTeam(teamId string) StoreChannel
   116  	RemoveAllMembersByUser(userId string) StoreChannel
   117  	UpdateLastTeamIconUpdate(teamId string, curTime int64) StoreChannel
   118  	GetTeamsByScheme(schemeId string, offset int, limit int) StoreChannel
   119  	MigrateTeamMembers(fromTeamId string, fromUserId string) StoreChannel
   120  	ResetAllTeamSchemes() StoreChannel
   121  	ClearAllCustomRoleAssignments() StoreChannel
   122  	AnalyticsGetTeamCountForScheme(schemeId string) StoreChannel
   123  	GetAllForExportAfter(limit int, afterId string) StoreChannel
   124  	GetTeamMembersForExport(userId string) StoreChannel
   125  }
   126  
   127  type ChannelStore interface {
   128  	Save(channel *model.Channel, maxChannelsPerTeam int64) StoreChannel
   129  	CreateDirectChannel(userId string, otherUserId string) StoreChannel
   130  	SaveDirectChannel(channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) StoreChannel
   131  	Update(channel *model.Channel) StoreChannel
   132  	Get(id string, allowFromCache bool) StoreChannel
   133  	InvalidateChannel(id string)
   134  	InvalidateChannelByName(teamId, name string)
   135  	GetFromMaster(id string) StoreChannel
   136  	Delete(channelId string, time int64) StoreChannel
   137  	Restore(channelId string, time int64) StoreChannel
   138  	SetDeleteAt(channelId string, deleteAt int64, updateAt int64) StoreChannel
   139  	PermanentDeleteByTeam(teamId string) StoreChannel
   140  	PermanentDelete(channelId string) StoreChannel
   141  	GetByName(team_id string, name string, allowFromCache bool) StoreChannel
   142  	GetByNames(team_id string, names []string, allowFromCache bool) StoreChannel
   143  	GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) StoreChannel
   144  	GetDeletedByName(team_id string, name string) StoreChannel
   145  	GetDeleted(team_id string, offset int, limit int) StoreChannel
   146  	GetChannels(teamId string, userId string, includeDeleted bool) StoreChannel
   147  	GetAllChannels(page, perPage int, includeDeleted bool) StoreChannel
   148  	GetMoreChannels(teamId string, userId string, offset int, limit int) StoreChannel
   149  	GetPublicChannelsForTeam(teamId string, offset int, limit int) StoreChannel
   150  	GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) StoreChannel
   151  	GetChannelCounts(teamId string, userId string) StoreChannel
   152  	GetTeamChannels(teamId string) StoreChannel
   153  	GetAll(teamId string) StoreChannel
   154  	GetChannelsByIds(channelIds []string) StoreChannel
   155  	GetForPost(postId string) StoreChannel
   156  	SaveMember(member *model.ChannelMember) StoreChannel
   157  	UpdateMember(member *model.ChannelMember) StoreChannel
   158  	GetMembers(channelId string, offset, limit int) StoreChannel
   159  	GetMember(channelId string, userId string) StoreChannel
   160  	GetChannelMembersTimezones(channelId string) StoreChannel
   161  	GetAllChannelMembersForUser(userId string, allowFromCache bool, includeDeleted bool) StoreChannel
   162  	InvalidateAllChannelMembersForUser(userId string)
   163  	IsUserInChannelUseCache(userId string, channelId string) bool
   164  	GetAllChannelMembersNotifyPropsForChannel(channelId string, allowFromCache bool) StoreChannel
   165  	InvalidateCacheForChannelMembersNotifyProps(channelId string)
   166  	GetMemberForPost(postId string, userId string) StoreChannel
   167  	InvalidateMemberCount(channelId string)
   168  	GetMemberCountFromCache(channelId string) int64
   169  	GetMemberCount(channelId string, allowFromCache bool) StoreChannel
   170  	GetPinnedPosts(channelId string) StoreChannel
   171  	RemoveMember(channelId string, userId string) StoreChannel
   172  	PermanentDeleteMembersByUser(userId string) StoreChannel
   173  	PermanentDeleteMembersByChannel(channelId string) StoreChannel
   174  	UpdateLastViewedAt(channelIds []string, userId string) StoreChannel
   175  	IncrementMentionCount(channelId string, userId string) StoreChannel
   176  	AnalyticsTypeCount(teamId string, channelType string) StoreChannel
   177  	GetMembersForUser(teamId string, userId string) StoreChannel
   178  	GetMembersForUserWithPagination(teamId, userId string, page, perPage int) StoreChannel
   179  	AutocompleteInTeam(teamId string, term string, includeDeleted bool) StoreChannel
   180  	AutocompleteInTeamForSearch(teamId string, userId string, term string, includeDeleted bool) StoreChannel
   181  	SearchAllChannels(term string, includeDeleted bool) StoreChannel
   182  	SearchInTeam(teamId string, term string, includeDeleted bool) StoreChannel
   183  	SearchMore(userId string, teamId string, term string) StoreChannel
   184  	GetMembersByIds(channelId string, userIds []string) StoreChannel
   185  	AnalyticsDeletedTypeCount(teamId string, channelType string) StoreChannel
   186  	GetChannelUnread(channelId, userId string) StoreChannel
   187  	ClearCaches()
   188  	GetChannelsByScheme(schemeId string, offset int, limit int) StoreChannel
   189  	MigrateChannelMembers(fromChannelId string, fromUserId string) StoreChannel
   190  	ResetAllChannelSchemes() StoreChannel
   191  	ClearAllCustomRoleAssignments() StoreChannel
   192  	MigratePublicChannels() error
   193  	GetAllChannelsForExportAfter(limit int, afterId string) StoreChannel
   194  	GetAllDirectChannelsForExportAfter(limit int, afterId string) StoreChannel
   195  	GetChannelMembersForExport(userId string, teamId string) StoreChannel
   196  	RemoveAllDeactivatedMembers(channelId string) StoreChannel
   197  	GetChannelsBatchForIndexing(startTime, endTime int64, limit int) StoreChannel
   198  }
   199  
   200  type ChannelMemberHistoryStore interface {
   201  	LogJoinEvent(userId string, channelId string, joinTime int64) StoreChannel
   202  	LogLeaveEvent(userId string, channelId string, leaveTime int64) StoreChannel
   203  	GetUsersInChannelDuring(startTime int64, endTime int64, channelId string) StoreChannel
   204  	PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
   205  }
   206  
   207  type PostStore interface {
   208  	Save(post *model.Post) StoreChannel
   209  	Update(newPost *model.Post, oldPost *model.Post) StoreChannel
   210  	Get(id string) StoreChannel
   211  	GetSingle(id string) StoreChannel
   212  	Delete(postId string, time int64, deleteByID string) StoreChannel
   213  	PermanentDeleteByUser(userId string) StoreChannel
   214  	PermanentDeleteByChannel(channelId string) StoreChannel
   215  	GetPosts(channelId string, offset int, limit int, allowFromCache bool) StoreChannel
   216  	GetFlaggedPosts(userId string, offset int, limit int) StoreChannel
   217  	GetFlaggedPostsForTeam(userId, teamId string, offset int, limit int) StoreChannel
   218  	GetFlaggedPostsForChannel(userId, channelId string, offset int, limit int) StoreChannel
   219  	GetPostsBefore(channelId string, postId string, numPosts int, offset int) StoreChannel
   220  	GetPostsAfter(channelId string, postId string, numPosts int, offset int) StoreChannel
   221  	GetPostsSince(channelId string, time int64, allowFromCache bool) StoreChannel
   222  	GetEtag(channelId string, allowFromCache bool) StoreChannel
   223  	Search(teamId string, userId string, params *model.SearchParams) StoreChannel
   224  	AnalyticsUserCountsWithPostsByDay(teamId string) StoreChannel
   225  	AnalyticsPostCountsByDay(teamId string) StoreChannel
   226  	AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) StoreChannel
   227  	ClearCaches()
   228  	InvalidateLastPostTimeCache(channelId string)
   229  	GetPostsCreatedAt(channelId string, time int64) StoreChannel
   230  	Overwrite(post *model.Post) StoreChannel
   231  	GetPostsByIds(postIds []string) StoreChannel
   232  	GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) StoreChannel
   233  	PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
   234  	GetOldest() StoreChannel
   235  	GetMaxPostSize() StoreChannel
   236  	GetParentsForExportAfter(limit int, afterId string) StoreChannel
   237  	GetRepliesForExport(parentId string) StoreChannel
   238  	GetDirectPostParentsForExportAfter(limit int, afterId string) StoreChannel
   239  }
   240  
   241  type UserStore interface {
   242  	Save(user *model.User) StoreChannel
   243  	Update(user *model.User, allowRoleUpdate bool) StoreChannel
   244  	UpdateLastPictureUpdate(userId string) StoreChannel
   245  	ResetLastPictureUpdate(userId string) StoreChannel
   246  	UpdateUpdateAt(userId string) StoreChannel
   247  	UpdatePassword(userId, newPassword string) StoreChannel
   248  	UpdateAuthData(userId string, service string, authData *string, email string, resetMfa bool) StoreChannel
   249  	UpdateMfaSecret(userId, secret string) StoreChannel
   250  	UpdateMfaActive(userId string, active bool) StoreChannel
   251  	Get(id string) StoreChannel
   252  	GetAll() StoreChannel
   253  	ClearCaches()
   254  	InvalidateProfilesInChannelCacheByUser(userId string)
   255  	InvalidateProfilesInChannelCache(channelId string)
   256  	GetProfilesInChannel(channelId string, offset int, limit int) StoreChannel
   257  	GetProfilesInChannelByStatus(channelId string, offset int, limit int) StoreChannel
   258  	GetAllProfilesInChannel(channelId string, allowFromCache bool) StoreChannel
   259  	GetProfilesNotInChannel(teamId string, channelId string, offset int, limit int) StoreChannel
   260  	GetProfilesWithoutTeam(offset int, limit int) StoreChannel
   261  	GetProfilesByUsernames(usernames []string, teamId string) StoreChannel
   262  	GetAllProfiles(options *model.UserGetOptions) StoreChannel
   263  	GetProfiles(options *model.UserGetOptions) StoreChannel
   264  	GetProfileByIds(userId []string, allowFromCache bool) StoreChannel
   265  	InvalidatProfileCacheForUser(userId string)
   266  	GetByEmail(email string) StoreChannel
   267  	GetByAuth(authData *string, authService string) StoreChannel
   268  	GetAllUsingAuthService(authService string) StoreChannel
   269  	GetByUsername(username string) StoreChannel
   270  	GetForLogin(loginId string, allowSignInWithUsername, allowSignInWithEmail bool) StoreChannel
   271  	VerifyEmail(userId, email string) StoreChannel
   272  	GetEtagForAllProfiles() StoreChannel
   273  	GetEtagForProfiles(teamId string) StoreChannel
   274  	UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel
   275  	GetSystemAdminProfiles() StoreChannel
   276  	PermanentDelete(userId string) StoreChannel
   277  	AnalyticsActiveCount(time int64) StoreChannel
   278  	GetUnreadCount(userId string) StoreChannel
   279  	GetUnreadCountForChannel(userId string, channelId string) StoreChannel
   280  	GetAnyUnreadPostCountForChannel(userId string, channelId string) StoreChannel
   281  	GetRecentlyActiveUsersForTeam(teamId string, offset, limit int) StoreChannel
   282  	GetNewUsersForTeam(teamId string, offset, limit int) StoreChannel
   283  	Search(teamId string, term string, options *model.UserSearchOptions) StoreChannel
   284  	SearchNotInTeam(notInTeamId string, term string, options *model.UserSearchOptions) StoreChannel
   285  	SearchInChannel(channelId string, term string, options *model.UserSearchOptions) StoreChannel
   286  	SearchNotInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) StoreChannel
   287  	SearchWithoutTeam(term string, options *model.UserSearchOptions) StoreChannel
   288  	AnalyticsGetInactiveUsersCount() StoreChannel
   289  	AnalyticsGetSystemAdminCount() StoreChannel
   290  	GetProfilesNotInTeam(teamId string, offset int, limit int) StoreChannel
   291  	GetEtagForProfilesNotInTeam(teamId string) StoreChannel
   292  	ClearAllCustomRoleAssignments() StoreChannel
   293  	InferSystemInstallDate() StoreChannel
   294  	GetAllAfter(limit int, afterId string) StoreChannel
   295  	GetUsersBatchForIndexing(startTime, endTime int64, limit int) StoreChannel
   296  	Count(options model.UserCountOptions) StoreChannel
   297  }
   298  
   299  type BotStore interface {
   300  	Get(userId string, includeDeleted bool) StoreChannel
   301  	GetAll(options *model.BotGetOptions) StoreChannel
   302  	Save(bot *model.Bot) StoreChannel
   303  	Update(bot *model.Bot) StoreChannel
   304  	PermanentDelete(userId string) StoreChannel
   305  }
   306  
   307  type SessionStore interface {
   308  	Save(session *model.Session) StoreChannel
   309  	Get(sessionIdOrToken string) StoreChannel
   310  	GetSessions(userId string) StoreChannel
   311  	GetSessionsWithActiveDeviceIds(userId string) StoreChannel
   312  	Remove(sessionIdOrToken string) StoreChannel
   313  	RemoveAllSessions() StoreChannel
   314  	PermanentDeleteSessionsByUser(teamId string) StoreChannel
   315  	UpdateLastActivityAt(sessionId string, time int64) StoreChannel
   316  	UpdateRoles(userId string, roles string) StoreChannel
   317  	UpdateDeviceId(id string, deviceId string, expiresAt int64) StoreChannel
   318  	AnalyticsSessionCount() StoreChannel
   319  	Cleanup(expiryTime int64, batchSize int64)
   320  }
   321  
   322  type AuditStore interface {
   323  	Save(audit *model.Audit) StoreChannel
   324  	Get(user_id string, offset int, limit int) StoreChannel
   325  	PermanentDeleteByUser(userId string) StoreChannel
   326  	PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
   327  }
   328  
   329  type ClusterDiscoveryStore interface {
   330  	Save(discovery *model.ClusterDiscovery) StoreChannel
   331  	Delete(discovery *model.ClusterDiscovery) StoreChannel
   332  	Exists(discovery *model.ClusterDiscovery) StoreChannel
   333  	GetAll(discoveryType, clusterName string) StoreChannel
   334  	SetLastPingAt(discovery *model.ClusterDiscovery) StoreChannel
   335  	Cleanup() StoreChannel
   336  }
   337  
   338  type ComplianceStore interface {
   339  	Save(compliance *model.Compliance) StoreChannel
   340  	Update(compliance *model.Compliance) StoreChannel
   341  	Get(id string) StoreChannel
   342  	GetAll(offset, limit int) StoreChannel
   343  	ComplianceExport(compliance *model.Compliance) StoreChannel
   344  	MessageExport(after int64, limit int) StoreChannel
   345  }
   346  
   347  type OAuthStore interface {
   348  	SaveApp(app *model.OAuthApp) StoreChannel
   349  	UpdateApp(app *model.OAuthApp) StoreChannel
   350  	GetApp(id string) StoreChannel
   351  	GetAppByUser(userId string, offset, limit int) StoreChannel
   352  	GetApps(offset, limit int) StoreChannel
   353  	GetAuthorizedApps(userId string, offset, limit int) StoreChannel
   354  	DeleteApp(id string) StoreChannel
   355  	SaveAuthData(authData *model.AuthData) StoreChannel
   356  	GetAuthData(code string) StoreChannel
   357  	RemoveAuthData(code string) StoreChannel
   358  	PermanentDeleteAuthDataByUser(userId string) StoreChannel
   359  	SaveAccessData(accessData *model.AccessData) StoreChannel
   360  	UpdateAccessData(accessData *model.AccessData) StoreChannel
   361  	GetAccessData(token string) StoreChannel
   362  	GetAccessDataByUserForApp(userId, clientId string) StoreChannel
   363  	GetAccessDataByRefreshToken(token string) StoreChannel
   364  	GetPreviousAccessData(userId, clientId string) StoreChannel
   365  	RemoveAccessData(token string) StoreChannel
   366  }
   367  
   368  type SystemStore interface {
   369  	Save(system *model.System) StoreChannel
   370  	SaveOrUpdate(system *model.System) StoreChannel
   371  	Update(system *model.System) StoreChannel
   372  	Get() StoreChannel
   373  	GetByName(name string) StoreChannel
   374  	PermanentDeleteByName(name string) StoreChannel
   375  }
   376  
   377  type WebhookStore interface {
   378  	SaveIncoming(webhook *model.IncomingWebhook) StoreChannel
   379  	GetIncoming(id string, allowFromCache bool) StoreChannel
   380  	GetIncomingList(offset, limit int) StoreChannel
   381  	GetIncomingByTeam(teamId string, offset, limit int) StoreChannel
   382  	UpdateIncoming(webhook *model.IncomingWebhook) StoreChannel
   383  	GetIncomingByChannel(channelId string) StoreChannel
   384  	DeleteIncoming(webhookId string, time int64) StoreChannel
   385  	PermanentDeleteIncomingByChannel(channelId string) StoreChannel
   386  	PermanentDeleteIncomingByUser(userId string) StoreChannel
   387  
   388  	SaveOutgoing(webhook *model.OutgoingWebhook) StoreChannel
   389  	GetOutgoing(id string) StoreChannel
   390  	GetOutgoingList(offset, limit int) StoreChannel
   391  	GetOutgoingByChannel(channelId string, offset, limit int) StoreChannel
   392  	GetOutgoingByTeam(teamId string, offset, limit int) StoreChannel
   393  	DeleteOutgoing(webhookId string, time int64) StoreChannel
   394  	PermanentDeleteOutgoingByChannel(channelId string) StoreChannel
   395  	PermanentDeleteOutgoingByUser(userId string) StoreChannel
   396  	UpdateOutgoing(hook *model.OutgoingWebhook) StoreChannel
   397  
   398  	AnalyticsIncomingCount(teamId string) StoreChannel
   399  	AnalyticsOutgoingCount(teamId string) StoreChannel
   400  	InvalidateWebhookCache(webhook string)
   401  	ClearCaches()
   402  }
   403  
   404  type CommandStore interface {
   405  	Save(webhook *model.Command) StoreChannel
   406  	Get(id string) StoreChannel
   407  	GetByTeam(teamId string) StoreChannel
   408  	GetByTrigger(teamId string, trigger string) StoreChannel
   409  	Delete(commandId string, time int64) StoreChannel
   410  	PermanentDeleteByTeam(teamId string) StoreChannel
   411  	PermanentDeleteByUser(userId string) StoreChannel
   412  	Update(hook *model.Command) StoreChannel
   413  	AnalyticsCommandCount(teamId string) StoreChannel
   414  }
   415  
   416  type CommandWebhookStore interface {
   417  	Save(webhook *model.CommandWebhook) StoreChannel
   418  	Get(id string) StoreChannel
   419  	TryUse(id string, limit int) StoreChannel
   420  	Cleanup()
   421  }
   422  
   423  type PreferenceStore interface {
   424  	Save(preferences *model.Preferences) StoreChannel
   425  	Get(userId string, category string, name string) StoreChannel
   426  	GetCategory(userId string, category string) StoreChannel
   427  	GetAll(userId string) StoreChannel
   428  	Delete(userId, category, name string) StoreChannel
   429  	DeleteCategory(userId string, category string) StoreChannel
   430  	DeleteCategoryAndName(category string, name string) StoreChannel
   431  	PermanentDeleteByUser(userId string) StoreChannel
   432  	IsFeatureEnabled(feature, userId string) StoreChannel
   433  	CleanupFlagsBatch(limit int64) StoreChannel
   434  }
   435  
   436  type LicenseStore interface {
   437  	Save(license *model.LicenseRecord) StoreChannel
   438  	Get(id string) StoreChannel
   439  }
   440  
   441  type TokenStore interface {
   442  	Save(recovery *model.Token) StoreChannel
   443  	Delete(token string) StoreChannel
   444  	GetByToken(token string) StoreChannel
   445  	Cleanup()
   446  	RemoveAllTokensByType(tokenType string) StoreChannel
   447  }
   448  
   449  type EmojiStore interface {
   450  	Save(emoji *model.Emoji) StoreChannel
   451  	Get(id string, allowFromCache bool) StoreChannel
   452  	GetByName(name string) StoreChannel
   453  	GetMultipleByName(names []string) StoreChannel
   454  	GetList(offset, limit int, sort string) StoreChannel
   455  	Delete(id string, time int64) StoreChannel
   456  	Search(name string, prefixOnly bool, limit int) StoreChannel
   457  }
   458  
   459  type StatusStore interface {
   460  	SaveOrUpdate(status *model.Status) StoreChannel
   461  	Get(userId string) StoreChannel
   462  	GetByIds(userIds []string) StoreChannel
   463  	GetOnlineAway() StoreChannel
   464  	GetOnline() StoreChannel
   465  	GetAllFromTeam(teamId string) StoreChannel
   466  	ResetAll() StoreChannel
   467  	GetTotalActiveUsersCount() StoreChannel
   468  	UpdateLastActivityAt(userId string, lastActivityAt int64) StoreChannel
   469  }
   470  
   471  type FileInfoStore interface {
   472  	Save(info *model.FileInfo) StoreChannel
   473  	Get(id string) StoreChannel
   474  	GetByPath(path string) StoreChannel
   475  	GetForPost(postId string, readFromMaster bool, allowFromCache bool) StoreChannel
   476  	GetForUser(userId string) StoreChannel
   477  	InvalidateFileInfosForPostCache(postId string)
   478  	AttachToPost(fileId string, postId string, creatorId string) StoreChannel
   479  	DeleteForPost(postId string) StoreChannel
   480  	PermanentDelete(fileId string) StoreChannel
   481  	PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
   482  	PermanentDeleteByUser(userId string) StoreChannel
   483  	ClearCaches()
   484  }
   485  
   486  type ReactionStore interface {
   487  	Save(reaction *model.Reaction) StoreChannel
   488  	Delete(reaction *model.Reaction) StoreChannel
   489  	GetForPost(postId string, allowFromCache bool) StoreChannel
   490  	DeleteAllWithEmojiName(emojiName string) StoreChannel
   491  	PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
   492  	BulkGetForPosts(postIds []string) StoreChannel
   493  }
   494  
   495  type JobStore interface {
   496  	Save(job *model.Job) StoreChannel
   497  	UpdateOptimistically(job *model.Job, currentStatus string) StoreChannel
   498  	UpdateStatus(id string, status string) StoreChannel
   499  	UpdateStatusOptimistically(id string, currentStatus string, newStatus string) StoreChannel
   500  	Get(id string) StoreChannel
   501  	GetAllPage(offset int, limit int) StoreChannel
   502  	GetAllByType(jobType string) StoreChannel
   503  	GetAllByTypePage(jobType string, offset int, limit int) StoreChannel
   504  	GetAllByStatus(status string) StoreChannel
   505  	GetNewestJobByStatusAndType(status string, jobType string) StoreChannel
   506  	GetCountByStatusAndType(status string, jobType string) StoreChannel
   507  	Delete(id string) StoreChannel
   508  }
   509  
   510  type UserAccessTokenStore interface {
   511  	Save(token *model.UserAccessToken) StoreChannel
   512  	Delete(tokenId string) StoreChannel
   513  	DeleteAllForUser(userId string) StoreChannel
   514  	Get(tokenId string) StoreChannel
   515  	GetAll(offset int, limit int) StoreChannel
   516  	GetByToken(tokenString string) StoreChannel
   517  	GetByUser(userId string, page, perPage int) StoreChannel
   518  	Search(term string) StoreChannel
   519  	UpdateTokenEnable(tokenId string) StoreChannel
   520  	UpdateTokenDisable(tokenId string) StoreChannel
   521  }
   522  
   523  type PluginStore interface {
   524  	SaveOrUpdate(keyVal *model.PluginKeyValue) StoreChannel
   525  	Get(pluginId, key string) StoreChannel
   526  	Delete(pluginId, key string) StoreChannel
   527  	DeleteAllForPlugin(PluginId string) StoreChannel
   528  	DeleteAllExpired() StoreChannel
   529  	List(pluginId string, page, perPage int) StoreChannel
   530  }
   531  
   532  type RoleStore interface {
   533  	Save(role *model.Role) StoreChannel
   534  	Get(roleId string) StoreChannel
   535  	GetAll() StoreChannel
   536  	GetByName(name string) StoreChannel
   537  	GetByNames(names []string) StoreChannel
   538  	Delete(roldId string) StoreChannel
   539  	PermanentDeleteAll() StoreChannel
   540  }
   541  
   542  type SchemeStore interface {
   543  	Save(scheme *model.Scheme) StoreChannel
   544  	Get(schemeId string) StoreChannel
   545  	GetByName(schemeName string) StoreChannel
   546  	GetAllPage(scope string, offset int, limit int) StoreChannel
   547  	Delete(schemeId string) StoreChannel
   548  	PermanentDeleteAll() StoreChannel
   549  }
   550  
   551  type TermsOfServiceStore interface {
   552  	Save(termsOfService *model.TermsOfService) StoreChannel
   553  	GetLatest(allowFromCache bool) StoreChannel
   554  	Get(id string, allowFromCache bool) StoreChannel
   555  }
   556  
   557  type UserTermsOfServiceStore interface {
   558  	GetByUser(userId string) StoreChannel
   559  	Save(userTermsOfService *model.UserTermsOfService) StoreChannel
   560  	Delete(userId, termsOfServiceId string) StoreChannel
   561  }
   562  
   563  type GroupStore interface {
   564  	Create(group *model.Group) StoreChannel
   565  	Get(groupID string) StoreChannel
   566  	GetByRemoteID(remoteID string, groupSource model.GroupSource) StoreChannel
   567  	GetAllBySource(groupSource model.GroupSource) StoreChannel
   568  	Update(group *model.Group) StoreChannel
   569  	Delete(groupID string) StoreChannel
   570  
   571  	GetMemberUsers(groupID string) StoreChannel
   572  	GetMemberUsersPage(groupID string, offset int, limit int) StoreChannel
   573  	GetMemberCount(groupID string) StoreChannel
   574  	CreateOrRestoreMember(groupID string, userID string) StoreChannel
   575  	DeleteMember(groupID string, userID string) StoreChannel
   576  
   577  	CreateGroupSyncable(groupSyncable *model.GroupSyncable) StoreChannel
   578  	GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) StoreChannel
   579  	GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) StoreChannel
   580  	UpdateGroupSyncable(groupSyncable *model.GroupSyncable) StoreChannel
   581  	DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) StoreChannel
   582  
   583  	PendingAutoAddTeamMembers(minGroupMembersCreateAt int64) StoreChannel
   584  	PendingAutoAddChannelMembers(minGroupMembersCreateAt int64) StoreChannel
   585  }
   586  
   587  type LinkMetadataStore interface {
   588  	Save(linkMetadata *model.LinkMetadata) StoreChannel
   589  	Get(url string, timestamp int64) StoreChannel
   590  }