2017-04-12 08:27:57 -04:00
|
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
2015-06-14 23:53:32 -08:00
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
package store
|
|
|
|
|
|
|
|
|
|
import (
|
2016-09-06 18:51:27 -04:00
|
|
|
"time"
|
|
|
|
|
|
2017-09-06 23:05:10 -07:00
|
|
|
"github.com/mattermost/mattermost-server/model"
|
2015-06-14 23:53:32 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type StoreResult struct {
|
|
|
|
|
Data interface{}
|
|
|
|
|
Err *model.AppError
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type StoreChannel chan StoreResult
|
|
|
|
|
|
2017-10-04 13:09:41 -07:00
|
|
|
func Do(f func(result *StoreResult)) StoreChannel {
|
|
|
|
|
storeChannel := make(StoreChannel, 1)
|
|
|
|
|
go func() {
|
|
|
|
|
result := StoreResult{}
|
|
|
|
|
f(&result)
|
|
|
|
|
storeChannel <- result
|
|
|
|
|
close(storeChannel)
|
|
|
|
|
}()
|
|
|
|
|
return storeChannel
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-06 00:50:42 -08:00
|
|
|
func Must(sc StoreChannel) interface{} {
|
|
|
|
|
r := <-sc
|
|
|
|
|
if r.Err != nil {
|
2018-04-27 12:49:45 -07:00
|
|
|
|
2015-08-20 14:20:39 -07:00
|
|
|
time.Sleep(time.Second)
|
2015-07-06 00:50:42 -08:00
|
|
|
panic(r.Err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return r.Data
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-14 23:53:32 -08:00
|
|
|
type Store interface {
|
|
|
|
|
Team() TeamStore
|
|
|
|
|
Channel() ChannelStore
|
|
|
|
|
Post() PostStore
|
|
|
|
|
User() UserStore
|
|
|
|
|
Audit() AuditStore
|
2017-06-19 08:44:04 -07:00
|
|
|
ClusterDiscovery() ClusterDiscoveryStore
|
2016-03-14 16:07:58 -07:00
|
|
|
Compliance() ComplianceStore
|
2015-06-14 23:53:32 -08:00
|
|
|
Session() SessionStore
|
2015-09-16 15:49:12 -04:00
|
|
|
OAuth() OAuthStore
|
2015-09-16 19:59:57 -07:00
|
|
|
System() SystemStore
|
2015-09-21 14:22:23 -04:00
|
|
|
Webhook() WebhookStore
|
2016-01-06 21:09:05 -06:00
|
|
|
Command() CommandStore
|
2017-08-16 07:17:57 -05:00
|
|
|
CommandWebhook() CommandWebhookStore
|
2015-10-01 10:56:07 -04:00
|
|
|
Preference() PreferenceStore
|
2016-02-04 13:00:03 -05:00
|
|
|
License() LicenseStore
|
2017-04-27 10:55:03 -04:00
|
|
|
Token() TokenStore
|
2016-06-14 09:38:19 -04:00
|
|
|
Emoji() EmojiStore
|
2016-07-18 11:10:03 -04:00
|
|
|
Status() StatusStore
|
2016-09-30 11:06:30 -04:00
|
|
|
FileInfo() FileInfoStore
|
2016-11-30 13:55:49 -05:00
|
|
|
Reaction() ReactionStore
|
2018-02-06 15:34:08 +00:00
|
|
|
Role() RoleStore
|
2018-04-20 19:49:13 +01:00
|
|
|
Scheme() SchemeStore
|
2017-07-07 15:21:02 +01:00
|
|
|
Job() JobStore
|
2017-07-31 12:59:32 -04:00
|
|
|
UserAccessToken() UserAccessTokenStore
|
2017-11-30 09:07:04 -05:00
|
|
|
ChannelMemberHistory() ChannelMemberHistoryStore
|
2017-11-27 17:23:35 -05:00
|
|
|
Plugin() PluginStore
|
2015-10-15 11:16:26 -07:00
|
|
|
MarkSystemRanUnitTests()
|
2015-06-14 23:53:32 -08:00
|
|
|
Close()
|
2016-04-21 22:37:01 -07:00
|
|
|
DropAllTables()
|
2016-10-19 14:49:25 -04:00
|
|
|
TotalMasterDbConnections() int
|
|
|
|
|
TotalReadDbConnections() int
|
2017-05-01 05:19:58 +01:00
|
|
|
TotalSearchDbConnections() int
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type TeamStore interface {
|
2016-01-20 13:36:16 -06:00
|
|
|
Save(team *model.Team) StoreChannel
|
|
|
|
|
Update(team *model.Team) StoreChannel
|
|
|
|
|
UpdateDisplayName(name string, teamId string) StoreChannel
|
|
|
|
|
Get(id string) StoreChannel
|
|
|
|
|
GetByName(name string) StoreChannel
|
2017-02-02 11:46:42 -05:00
|
|
|
SearchByName(name string) StoreChannel
|
2017-04-04 02:34:14 +09:00
|
|
|
SearchAll(term string) StoreChannel
|
|
|
|
|
SearchOpen(term string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
GetAll() StoreChannel
|
2017-02-28 10:41:38 +02:00
|
|
|
GetAllPage(offset int, limit int) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
GetAllTeamListing() StoreChannel
|
2017-02-28 10:41:38 +02:00
|
|
|
GetAllTeamPageListing(offset int, limit int) StoreChannel
|
2016-04-21 22:37:01 -07:00
|
|
|
GetTeamsByUserId(userId string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
GetByInviteId(inviteId string) StoreChannel
|
|
|
|
|
PermanentDelete(teamId string) StoreChannel
|
2016-02-25 12:32:46 -05:00
|
|
|
AnalyticsTeamCount() StoreChannel
|
2017-10-20 17:34:07 -07:00
|
|
|
SaveMember(member *model.TeamMember, maxUsersPerTeam int) StoreChannel
|
2016-04-21 22:37:01 -07:00
|
|
|
UpdateMember(member *model.TeamMember) StoreChannel
|
2016-05-16 12:55:22 -04:00
|
|
|
GetMember(teamId string, userId string) StoreChannel
|
2016-10-19 14:49:25 -04:00
|
|
|
GetMembers(teamId string, offset int, limit int) StoreChannel
|
|
|
|
|
GetMembersByIds(teamId string, userIds []string) StoreChannel
|
2016-11-04 12:27:19 -04:00
|
|
|
GetTotalMemberCount(teamId string) StoreChannel
|
|
|
|
|
GetActiveMemberCount(teamId string) StoreChannel
|
2016-04-21 22:37:01 -07:00
|
|
|
GetTeamsForUser(userId string) StoreChannel
|
2017-03-13 09:46:28 -04:00
|
|
|
GetChannelUnreadsForAllTeams(excludeTeamId, userId string) StoreChannel
|
|
|
|
|
GetChannelUnreadsForTeam(teamId, userId string) StoreChannel
|
2016-04-21 22:37:01 -07:00
|
|
|
RemoveMember(teamId string, userId string) StoreChannel
|
|
|
|
|
RemoveAllMembersByTeam(teamId string) StoreChannel
|
|
|
|
|
RemoveAllMembersByUser(userId string) StoreChannel
|
2018-03-01 20:11:44 +01:00
|
|
|
UpdateLastTeamIconUpdate(teamId string, curTime int64) StoreChannel
|
2018-04-20 19:49:13 +01:00
|
|
|
GetTeamsByScheme(schemeId string, offset int, limit int) StoreChannel
|
2018-05-14 15:59:04 +01:00
|
|
|
MigrateTeamMembers(fromTeamId string, fromUserId string) StoreChannel
|
2018-05-17 16:28:14 +01:00
|
|
|
ResetAllTeamSchemes() StoreChannel
|
2018-06-25 14:34:59 +01:00
|
|
|
ClearAllCustomRoleAssignments() StoreChannel
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ChannelStore interface {
|
2017-10-20 17:33:20 -07:00
|
|
|
Save(channel *model.Channel, maxChannelsPerTeam int64) StoreChannel
|
2016-10-17 15:12:56 +03:00
|
|
|
CreateDirectChannel(userId string, otherUserId string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
SaveDirectChannel(channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) StoreChannel
|
|
|
|
|
Update(channel *model.Channel) StoreChannel
|
2017-01-03 09:53:59 -05:00
|
|
|
Get(id string, allowFromCache bool) StoreChannel
|
|
|
|
|
InvalidateChannel(id string)
|
2017-01-27 14:07:34 -05:00
|
|
|
InvalidateChannelByName(teamId, name string)
|
2016-01-20 13:36:16 -06:00
|
|
|
GetFromMaster(id string) StoreChannel
|
|
|
|
|
Delete(channelId string, time int64) StoreChannel
|
2017-05-15 22:12:30 +02:00
|
|
|
Restore(channelId string, time int64) StoreChannel
|
2016-07-06 10:11:21 -08:00
|
|
|
SetDeleteAt(channelId string, deleteAt int64, updateAt int64) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
PermanentDeleteByTeam(teamId string) StoreChannel
|
2017-02-02 11:46:42 -05:00
|
|
|
PermanentDelete(channelId string) StoreChannel
|
2017-01-27 14:07:34 -05:00
|
|
|
GetByName(team_id string, name string, allowFromCache bool) StoreChannel
|
2017-11-28 15:02:56 -06:00
|
|
|
GetByNames(team_id string, names []string, allowFromCache bool) StoreChannel
|
2017-01-27 14:07:34 -05:00
|
|
|
GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) StoreChannel
|
2017-01-26 02:14:12 +00:00
|
|
|
GetDeletedByName(team_id string, name string) StoreChannel
|
2017-05-09 14:52:46 +02:00
|
|
|
GetDeleted(team_id string, offset int, limit int) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
GetChannels(teamId string, userId string) StoreChannel
|
2016-11-24 09:35:09 -05:00
|
|
|
GetMoreChannels(teamId string, userId string, offset int, limit int) StoreChannel
|
2017-03-13 21:26:51 +09:00
|
|
|
GetPublicChannelsForTeam(teamId string, offset int, limit int) StoreChannel
|
2017-03-27 20:41:40 +09:00
|
|
|
GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
GetChannelCounts(teamId string, userId string) StoreChannel
|
2016-11-10 11:23:55 -03:00
|
|
|
GetTeamChannels(teamId string) StoreChannel
|
2016-07-06 10:11:21 -08:00
|
|
|
GetAll(teamId string) StoreChannel
|
2016-09-30 11:06:30 -04:00
|
|
|
GetForPost(postId string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
SaveMember(member *model.ChannelMember) StoreChannel
|
|
|
|
|
UpdateMember(member *model.ChannelMember) StoreChannel
|
2017-02-07 14:58:27 -08:00
|
|
|
GetMembers(channelId string, offset, limit int) StoreChannel
|
2017-02-27 17:43:23 -05:00
|
|
|
GetMember(channelId string, userId string) StoreChannel
|
2016-10-19 14:49:25 -04:00
|
|
|
GetAllChannelMembersForUser(userId string, allowFromCache bool) StoreChannel
|
|
|
|
|
InvalidateAllChannelMembersForUser(userId string)
|
|
|
|
|
IsUserInChannelUseCache(userId string, channelId string) bool
|
2017-02-23 11:08:48 -03:00
|
|
|
GetAllChannelMembersNotifyPropsForChannel(channelId string, allowFromCache bool) StoreChannel
|
|
|
|
|
InvalidateCacheForChannelMembersNotifyProps(channelId string)
|
2016-09-30 11:06:30 -04:00
|
|
|
GetMemberForPost(postId string, userId string) StoreChannel
|
2016-11-24 05:26:45 -08:00
|
|
|
InvalidateMemberCount(channelId string)
|
2017-01-03 11:45:45 -05:00
|
|
|
GetMemberCountFromCache(channelId string) int64
|
2016-11-24 05:26:45 -08:00
|
|
|
GetMemberCount(channelId string, allowFromCache bool) StoreChannel
|
2017-03-13 13:25:08 +01:00
|
|
|
GetPinnedPosts(channelId string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
RemoveMember(channelId string, userId string) StoreChannel
|
|
|
|
|
PermanentDeleteMembersByUser(userId string) StoreChannel
|
2017-02-02 11:46:42 -05:00
|
|
|
PermanentDeleteMembersByChannel(channelId string) StoreChannel
|
2016-12-23 10:32:30 -05:00
|
|
|
UpdateLastViewedAt(channelIds []string, userId string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
IncrementMentionCount(channelId string, userId string) StoreChannel
|
|
|
|
|
AnalyticsTypeCount(teamId string, channelType string) StoreChannel
|
2016-10-27 12:24:30 -03:00
|
|
|
GetMembersForUser(teamId string, userId string) StoreChannel
|
2018-01-31 08:26:40 -06:00
|
|
|
AutocompleteInTeam(teamId string, term string) StoreChannel
|
2016-11-24 09:35:09 -05:00
|
|
|
SearchInTeam(teamId string, term string) StoreChannel
|
|
|
|
|
SearchMore(userId string, teamId string, term string) StoreChannel
|
2016-12-22 18:21:05 +00:00
|
|
|
GetMembersByIds(channelId string, userIds []string) StoreChannel
|
2017-02-24 17:33:59 +00:00
|
|
|
AnalyticsDeletedTypeCount(teamId string, channelType string) StoreChannel
|
2017-03-16 14:58:33 -04:00
|
|
|
GetChannelUnread(channelId, userId string) StoreChannel
|
2018-03-05 10:35:26 -05:00
|
|
|
ClearCaches()
|
2018-04-20 19:49:13 +01:00
|
|
|
GetChannelsByScheme(schemeId string, offset int, limit int) StoreChannel
|
2018-05-14 15:59:04 +01:00
|
|
|
MigrateChannelMembers(fromChannelId string, fromUserId string) StoreChannel
|
2018-05-17 16:28:14 +01:00
|
|
|
ResetAllChannelSchemes() StoreChannel
|
2018-06-25 14:34:59 +01:00
|
|
|
ClearAllCustomRoleAssignments() StoreChannel
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
|
|
|
|
|
2017-11-30 09:07:04 -05:00
|
|
|
type ChannelMemberHistoryStore interface {
|
|
|
|
|
LogJoinEvent(userId string, channelId string, joinTime int64) StoreChannel
|
|
|
|
|
LogLeaveEvent(userId string, channelId string, leaveTime int64) StoreChannel
|
|
|
|
|
GetUsersInChannelDuring(startTime int64, endTime int64, channelId string) StoreChannel
|
2017-12-05 16:32:23 -05:00
|
|
|
PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
|
2017-11-30 09:07:04 -05:00
|
|
|
}
|
|
|
|
|
|
2015-06-14 23:53:32 -08:00
|
|
|
type PostStore interface {
|
2016-01-20 13:36:16 -06:00
|
|
|
Save(post *model.Post) StoreChannel
|
2016-09-30 11:06:30 -04:00
|
|
|
Update(newPost *model.Post, oldPost *model.Post) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
Get(id string) StoreChannel
|
2017-01-25 09:32:42 -05:00
|
|
|
GetSingle(id string) StoreChannel
|
2018-06-01 12:45:46 -04:00
|
|
|
Delete(postId string, time int64, deleteByID string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
PermanentDeleteByUser(userId string) StoreChannel
|
2017-02-02 11:46:42 -05:00
|
|
|
PermanentDeleteByChannel(channelId string) StoreChannel
|
2016-12-22 18:14:54 -05:00
|
|
|
GetPosts(channelId string, offset int, limit int, allowFromCache bool) StoreChannel
|
2016-08-04 11:38:09 -04:00
|
|
|
GetFlaggedPosts(userId string, offset int, limit int) StoreChannel
|
2017-03-31 12:25:39 -04:00
|
|
|
GetFlaggedPostsForTeam(userId, teamId string, offset int, limit int) StoreChannel
|
2017-04-06 05:18:23 +09:00
|
|
|
GetFlaggedPostsForChannel(userId, channelId string, offset int, limit int) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
GetPostsBefore(channelId string, postId string, numPosts int, offset int) StoreChannel
|
|
|
|
|
GetPostsAfter(channelId string, postId string, numPosts int, offset int) StoreChannel
|
2016-12-20 09:41:04 -05:00
|
|
|
GetPostsSince(channelId string, time int64, allowFromCache bool) StoreChannel
|
2016-12-13 22:24:24 -05:00
|
|
|
GetEtag(channelId string, allowFromCache bool) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
Search(teamId string, userId string, params *model.SearchParams) StoreChannel
|
|
|
|
|
AnalyticsUserCountsWithPostsByDay(teamId string) StoreChannel
|
|
|
|
|
AnalyticsPostCountsByDay(teamId string) StoreChannel
|
2016-02-02 08:41:02 -05:00
|
|
|
AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) StoreChannel
|
2018-03-05 10:35:26 -05:00
|
|
|
ClearCaches()
|
2016-12-20 09:41:04 -05:00
|
|
|
InvalidateLastPostTimeCache(channelId string)
|
2017-02-28 23:55:21 +00:00
|
|
|
GetPostsCreatedAt(channelId string, time int64) StoreChannel
|
|
|
|
|
Overwrite(post *model.Post) StoreChannel
|
2017-05-18 16:26:52 +01:00
|
|
|
GetPostsByIds(postIds []string) StoreChannel
|
2017-10-25 13:23:01 +01:00
|
|
|
GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) StoreChannel
|
2017-09-15 17:35:55 +01:00
|
|
|
PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
|
2017-10-25 13:23:01 +01:00
|
|
|
GetOldest() StoreChannel
|
Relax 4k post message limit (#8478)
* MM-9661: rename POST_MESSAGE_MAX_RUNES to \0_v1
* MM-9661: s/4000/POST_MESSAGE_MAX_RUNES_V1/ in tests
* MM-9661: introduce POST_MESSAGE_MAX_RUNES_V2
* MM-9661: migrate Postgres Posts.Message column to TEXT from VARCHAR(4000)
This is safe to do in a production instance since the underyling type is
not changing. We explicitly don't do this automatically for MySQL, but
also don't need to since the ORM would have already created a TEXT column
for MySQL in that case.
* MM-9661: emit MaxPostSize in client config
This value remains unconfigurable at this time, but exposes the current
limit to the client. The limit remains at 4k in this commit.
* MM-9661: introduce and use SqlPostStore.GetMaxPostSize
Enforce a byte limitation in the database, and use 1/4 of that value as
the rune count limitation (assuming a worst case UTF-8 representation).
* move maxPostSizeCached, lastPostsCache and lastPostTimeCache out of the global context and onto the SqlPostStore
* address feedback from code review:
* ensure sqlstore unit tests are actually being run
* move global caches into SqlPostStore
* leverage sync.Once to address a race condition
* modify upgrade semantics to match new db semantics
gorp's behaviour on creating columns with a maximum length on Postgres
differs from MySQL:
* Postgres
* gorp uses TEXT for string columns without a maximum length
* gorp uses VARCHAR(N) for string columns with a maximum length of N
* MySQL
* gorp uses TEXT for string columns with a maximum length >= 256
* gorp uses VARCHAR(N) for string columns with a maximum length of N
* gorp defaults to a maximum length of 255, implying VARCHAR(255)
So the Message column has been TEXT on MySQL but VARCHAR(4000) on
Postgres. With the new, longer limits of 65535, and without changes to
gorp, the expected behaviour is TEXT on MySQL and VARCHAR(65535) on
Postgres. This commit makes the upgrade semantics match the new database
semantics.
Ideally, we'd revisit the gorp behaviour at a later time.
* allow TestMaxPostSize test cases to actually run in parallel
* default maxPostSizeCached to POST_MESSAGE_MAX_RUNES_V1 in case the once initializer panics
* fix casting error
* MM-9661: skip the schema migration for Postgres
It turns out resizing VARCHAR requires a rewrite in some versions of
Postgres, but migrating VARCHAR to TEXT does not. Given the increasing
complexity, let's defer the migration to the enduser instead.
2018-03-26 17:55:35 -04:00
|
|
|
GetMaxPostSize() StoreChannel
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UserStore interface {
|
2016-01-20 13:36:16 -06:00
|
|
|
Save(user *model.User) StoreChannel
|
|
|
|
|
Update(user *model.User, allowRoleUpdate bool) StoreChannel
|
|
|
|
|
UpdateLastPictureUpdate(userId string) StoreChannel
|
2016-05-12 18:36:30 -07:00
|
|
|
UpdateUpdateAt(userId string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
UpdatePassword(userId, newPassword string) StoreChannel
|
2016-12-12 08:16:10 -05:00
|
|
|
UpdateAuthData(userId string, service string, authData *string, email string, resetMfa bool) StoreChannel
|
2016-03-30 12:49:29 -04:00
|
|
|
UpdateMfaSecret(userId, secret string) StoreChannel
|
|
|
|
|
UpdateMfaActive(userId string, active bool) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
Get(id string) StoreChannel
|
2016-04-21 22:37:01 -07:00
|
|
|
GetAll() StoreChannel
|
2018-03-05 10:35:26 -05:00
|
|
|
ClearCaches()
|
2016-11-10 06:25:23 -08:00
|
|
|
InvalidateProfilesInChannelCacheByUser(userId string)
|
2016-10-19 14:49:25 -04:00
|
|
|
InvalidateProfilesInChannelCache(channelId string)
|
2017-02-03 15:17:34 -05:00
|
|
|
GetProfilesInChannel(channelId string, offset int, limit int) StoreChannel
|
2018-03-09 05:48:30 -07:00
|
|
|
GetProfilesInChannelByStatus(channelId string, offset int, limit int) StoreChannel
|
2017-02-03 15:17:34 -05:00
|
|
|
GetAllProfilesInChannel(channelId string, allowFromCache bool) StoreChannel
|
2016-10-19 14:49:25 -04:00
|
|
|
GetProfilesNotInChannel(teamId string, channelId string, offset int, limit int) StoreChannel
|
2017-03-29 21:11:40 -04:00
|
|
|
GetProfilesWithoutTeam(offset int, limit int) StoreChannel
|
2016-10-19 14:49:25 -04:00
|
|
|
GetProfilesByUsernames(usernames []string, teamId string) StoreChannel
|
|
|
|
|
GetAllProfiles(offset int, limit int) StoreChannel
|
|
|
|
|
GetProfiles(teamId string, offset int, limit int) StoreChannel
|
2016-12-13 19:23:36 -08:00
|
|
|
GetProfileByIds(userId []string, allowFromCache bool) StoreChannel
|
|
|
|
|
InvalidatProfileCacheForUser(userId string)
|
2016-04-21 22:37:01 -07:00
|
|
|
GetByEmail(email string) StoreChannel
|
2016-05-11 11:04:30 -07:00
|
|
|
GetByAuth(authData *string, authService string) StoreChannel
|
2016-06-03 09:33:59 -04:00
|
|
|
GetAllUsingAuthService(authService string) StoreChannel
|
2016-04-21 22:37:01 -07:00
|
|
|
GetByUsername(username string) StoreChannel
|
2018-05-10 09:46:09 -07:00
|
|
|
GetForLogin(loginId string, allowSignInWithUsername, allowSignInWithEmail bool) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
VerifyEmail(userId string) StoreChannel
|
2016-05-04 06:31:42 -07:00
|
|
|
GetEtagForAllProfiles() StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
GetEtagForProfiles(teamId string) StoreChannel
|
|
|
|
|
UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel
|
|
|
|
|
GetTotalUsersCount() StoreChannel
|
|
|
|
|
GetSystemAdminProfiles() StoreChannel
|
|
|
|
|
PermanentDelete(userId string) StoreChannel
|
2016-01-21 12:14:17 -05:00
|
|
|
AnalyticsUniqueUserCount(teamId string) StoreChannel
|
2017-01-20 15:24:53 -05:00
|
|
|
AnalyticsActiveCount(time int64) StoreChannel
|
2016-03-11 00:14:55 -03:00
|
|
|
GetUnreadCount(userId string) StoreChannel
|
2016-08-31 12:52:14 -04:00
|
|
|
GetUnreadCountForChannel(userId string, channelId string) StoreChannel
|
2017-06-30 12:07:23 -04:00
|
|
|
GetRecentlyActiveUsersForTeam(teamId string, offset, limit int) StoreChannel
|
|
|
|
|
GetNewUsersForTeam(teamId string, offset, limit int) StoreChannel
|
2016-11-02 14:38:34 -04:00
|
|
|
Search(teamId string, term string, options map[string]bool) StoreChannel
|
2017-04-03 18:11:12 +01:00
|
|
|
SearchNotInTeam(notInTeamId string, term string, options map[string]bool) StoreChannel
|
2016-11-02 14:38:34 -04:00
|
|
|
SearchInChannel(channelId string, term string, options map[string]bool) StoreChannel
|
|
|
|
|
SearchNotInChannel(teamId string, channelId string, term string, options map[string]bool) StoreChannel
|
2017-03-23 06:34:22 -04:00
|
|
|
SearchWithoutTeam(term string, options map[string]bool) StoreChannel
|
2017-02-24 17:33:59 +00:00
|
|
|
AnalyticsGetInactiveUsersCount() StoreChannel
|
|
|
|
|
AnalyticsGetSystemAdminCount() StoreChannel
|
2017-03-30 02:10:51 +01:00
|
|
|
GetProfilesNotInTeam(teamId string, offset int, limit int) StoreChannel
|
|
|
|
|
GetEtagForProfilesNotInTeam(teamId string) StoreChannel
|
2018-06-25 14:34:59 +01:00
|
|
|
ClearAllCustomRoleAssignments() StoreChannel
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SessionStore interface {
|
2016-01-20 13:36:16 -06:00
|
|
|
Save(session *model.Session) StoreChannel
|
|
|
|
|
Get(sessionIdOrToken string) StoreChannel
|
|
|
|
|
GetSessions(userId string) StoreChannel
|
2016-10-24 17:04:11 -07:00
|
|
|
GetSessionsWithActiveDeviceIds(userId string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
Remove(sessionIdOrToken string) StoreChannel
|
2016-04-21 22:37:01 -07:00
|
|
|
RemoveAllSessions() StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
PermanentDeleteSessionsByUser(teamId string) StoreChannel
|
|
|
|
|
UpdateLastActivityAt(sessionId string, time int64) StoreChannel
|
|
|
|
|
UpdateRoles(userId string, roles string) StoreChannel
|
2016-07-21 08:36:11 -08:00
|
|
|
UpdateDeviceId(id string, deviceId string, expiresAt int64) StoreChannel
|
2016-04-21 22:37:01 -07:00
|
|
|
AnalyticsSessionCount() StoreChannel
|
2018-01-17 08:50:49 -05:00
|
|
|
Cleanup(expiryTime int64, batchSize int64)
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type AuditStore interface {
|
2016-01-20 13:36:16 -06:00
|
|
|
Save(audit *model.Audit) StoreChannel
|
2017-02-21 21:07:57 +09:00
|
|
|
Get(user_id string, offset int, limit int) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
PermanentDeleteByUser(userId string) StoreChannel
|
2017-09-15 17:35:55 +01:00
|
|
|
PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
|
2015-06-14 23:53:32 -08:00
|
|
|
}
|
2015-09-16 15:49:12 -04:00
|
|
|
|
2017-06-19 08:44:04 -07:00
|
|
|
type ClusterDiscoveryStore interface {
|
|
|
|
|
Save(discovery *model.ClusterDiscovery) StoreChannel
|
|
|
|
|
Delete(discovery *model.ClusterDiscovery) StoreChannel
|
|
|
|
|
Exists(discovery *model.ClusterDiscovery) StoreChannel
|
|
|
|
|
GetAll(discoveryType, clusterName string) StoreChannel
|
|
|
|
|
SetLastPingAt(discovery *model.ClusterDiscovery) StoreChannel
|
|
|
|
|
Cleanup() StoreChannel
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-14 16:07:58 -07:00
|
|
|
type ComplianceStore interface {
|
|
|
|
|
Save(compliance *model.Compliance) StoreChannel
|
|
|
|
|
Update(compliance *model.Compliance) StoreChannel
|
|
|
|
|
Get(id string) StoreChannel
|
2017-03-13 10:14:16 -04:00
|
|
|
GetAll(offset, limit int) StoreChannel
|
2016-03-14 16:07:58 -07:00
|
|
|
ComplianceExport(compliance *model.Compliance) StoreChannel
|
2017-11-30 09:07:04 -05:00
|
|
|
MessageExport(after int64, limit int) StoreChannel
|
2016-03-14 16:07:58 -07:00
|
|
|
}
|
|
|
|
|
|
2015-09-16 15:49:12 -04:00
|
|
|
type OAuthStore interface {
|
2016-01-20 13:36:16 -06:00
|
|
|
SaveApp(app *model.OAuthApp) StoreChannel
|
|
|
|
|
UpdateApp(app *model.OAuthApp) StoreChannel
|
|
|
|
|
GetApp(id string) StoreChannel
|
2017-04-12 16:29:42 -04:00
|
|
|
GetAppByUser(userId string, offset, limit int) StoreChannel
|
|
|
|
|
GetApps(offset, limit int) StoreChannel
|
|
|
|
|
GetAuthorizedApps(userId string, offset, limit int) StoreChannel
|
2016-08-03 12:19:27 -05:00
|
|
|
DeleteApp(id string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
SaveAuthData(authData *model.AuthData) StoreChannel
|
|
|
|
|
GetAuthData(code string) StoreChannel
|
|
|
|
|
RemoveAuthData(code string) StoreChannel
|
|
|
|
|
PermanentDeleteAuthDataByUser(userId string) StoreChannel
|
|
|
|
|
SaveAccessData(accessData *model.AccessData) StoreChannel
|
2016-08-03 12:19:27 -05:00
|
|
|
UpdateAccessData(accessData *model.AccessData) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
GetAccessData(token string) StoreChannel
|
2016-08-23 19:06:17 -03:00
|
|
|
GetAccessDataByUserForApp(userId, clientId string) StoreChannel
|
2016-08-03 12:19:27 -05:00
|
|
|
GetAccessDataByRefreshToken(token string) StoreChannel
|
|
|
|
|
GetPreviousAccessData(userId, clientId string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
RemoveAccessData(token string) StoreChannel
|
2015-09-16 15:49:12 -04:00
|
|
|
}
|
2015-09-16 19:59:57 -07:00
|
|
|
|
|
|
|
|
type SystemStore interface {
|
2016-01-20 13:36:16 -06:00
|
|
|
Save(system *model.System) StoreChannel
|
2016-02-04 13:00:03 -05:00
|
|
|
SaveOrUpdate(system *model.System) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
Update(system *model.System) StoreChannel
|
|
|
|
|
Get() StoreChannel
|
2016-04-11 13:45:03 -04:00
|
|
|
GetByName(name string) StoreChannel
|
2018-04-18 10:18:07 +01:00
|
|
|
PermanentDeleteByName(name string) StoreChannel
|
2015-09-16 19:59:57 -07:00
|
|
|
}
|
2015-09-21 14:22:23 -04:00
|
|
|
|
|
|
|
|
type WebhookStore interface {
|
2016-01-20 13:36:16 -06:00
|
|
|
SaveIncoming(webhook *model.IncomingWebhook) StoreChannel
|
2017-01-27 14:07:34 -05:00
|
|
|
GetIncoming(id string, allowFromCache bool) StoreChannel
|
2017-02-21 19:42:34 -05:00
|
|
|
GetIncomingList(offset, limit int) StoreChannel
|
|
|
|
|
GetIncomingByTeam(teamId string, offset, limit int) StoreChannel
|
2017-02-27 00:18:20 +05:30
|
|
|
UpdateIncoming(webhook *model.IncomingWebhook) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
GetIncomingByChannel(channelId string) StoreChannel
|
|
|
|
|
DeleteIncoming(webhookId string, time int64) StoreChannel
|
2017-07-31 08:52:45 -07:00
|
|
|
PermanentDeleteIncomingByChannel(channelId string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
PermanentDeleteIncomingByUser(userId string) StoreChannel
|
2017-02-27 00:18:20 +05:30
|
|
|
|
2016-01-20 13:36:16 -06:00
|
|
|
SaveOutgoing(webhook *model.OutgoingWebhook) StoreChannel
|
|
|
|
|
GetOutgoing(id string) StoreChannel
|
2017-03-13 10:40:43 -04:00
|
|
|
GetOutgoingList(offset, limit int) StoreChannel
|
|
|
|
|
GetOutgoingByChannel(channelId string, offset, limit int) StoreChannel
|
|
|
|
|
GetOutgoingByTeam(teamId string, offset, limit int) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
DeleteOutgoing(webhookId string, time int64) StoreChannel
|
2017-07-31 08:52:45 -07:00
|
|
|
PermanentDeleteOutgoingByChannel(channelId string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
PermanentDeleteOutgoingByUser(userId string) StoreChannel
|
|
|
|
|
UpdateOutgoing(hook *model.OutgoingWebhook) StoreChannel
|
2017-02-27 00:18:20 +05:30
|
|
|
|
2016-02-02 08:41:02 -05:00
|
|
|
AnalyticsIncomingCount(teamId string) StoreChannel
|
|
|
|
|
AnalyticsOutgoingCount(teamId string) StoreChannel
|
2017-01-27 14:07:34 -05:00
|
|
|
InvalidateWebhookCache(webhook string)
|
2018-03-05 10:35:26 -05:00
|
|
|
ClearCaches()
|
2015-09-21 14:22:23 -04:00
|
|
|
}
|
2015-10-01 10:56:07 -04:00
|
|
|
|
2016-01-06 21:09:05 -06:00
|
|
|
type CommandStore interface {
|
|
|
|
|
Save(webhook *model.Command) StoreChannel
|
|
|
|
|
Get(id string) StoreChannel
|
|
|
|
|
GetByTeam(teamId string) StoreChannel
|
2017-10-04 19:08:59 +01:00
|
|
|
GetByTrigger(teamId string, trigger string) StoreChannel
|
2016-01-06 21:09:05 -06:00
|
|
|
Delete(commandId string, time int64) StoreChannel
|
2017-07-31 08:52:45 -07:00
|
|
|
PermanentDeleteByTeam(teamId string) StoreChannel
|
2016-01-06 21:09:05 -06:00
|
|
|
PermanentDeleteByUser(userId string) StoreChannel
|
|
|
|
|
Update(hook *model.Command) StoreChannel
|
2016-02-25 12:32:46 -05:00
|
|
|
AnalyticsCommandCount(teamId string) StoreChannel
|
2016-01-06 21:09:05 -06:00
|
|
|
}
|
|
|
|
|
|
2017-08-16 07:17:57 -05:00
|
|
|
type CommandWebhookStore interface {
|
|
|
|
|
Save(webhook *model.CommandWebhook) StoreChannel
|
|
|
|
|
Get(id string) StoreChannel
|
|
|
|
|
TryUse(id string, limit int) StoreChannel
|
|
|
|
|
Cleanup()
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-01 10:56:07 -04:00
|
|
|
type PreferenceStore interface {
|
2016-01-20 13:36:16 -06:00
|
|
|
Save(preferences *model.Preferences) StoreChannel
|
|
|
|
|
Get(userId string, category string, name string) StoreChannel
|
|
|
|
|
GetCategory(userId string, category string) StoreChannel
|
|
|
|
|
GetAll(userId string) StoreChannel
|
2016-07-14 10:08:36 -04:00
|
|
|
Delete(userId, category, name string) StoreChannel
|
2016-12-19 10:05:46 -03:00
|
|
|
DeleteCategory(userId string, category string) StoreChannel
|
2017-01-25 09:32:42 -05:00
|
|
|
DeleteCategoryAndName(category string, name string) StoreChannel
|
2016-01-20 13:36:16 -06:00
|
|
|
PermanentDeleteByUser(userId string) StoreChannel
|
|
|
|
|
IsFeatureEnabled(feature, userId string) StoreChannel
|
2017-09-22 18:23:16 +01:00
|
|
|
CleanupFlagsBatch(limit int64) StoreChannel
|
2015-11-19 17:54:01 +01:00
|
|
|
}
|
2016-02-04 13:00:03 -05:00
|
|
|
|
|
|
|
|
type LicenseStore interface {
|
|
|
|
|
Save(license *model.LicenseRecord) StoreChannel
|
|
|
|
|
Get(id string) StoreChannel
|
|
|
|
|
}
|
2016-04-21 22:37:01 -07:00
|
|
|
|
2017-04-27 10:55:03 -04:00
|
|
|
type TokenStore interface {
|
|
|
|
|
Save(recovery *model.Token) StoreChannel
|
|
|
|
|
Delete(token string) StoreChannel
|
|
|
|
|
GetByToken(token string) StoreChannel
|
|
|
|
|
Cleanup()
|
2016-04-21 22:37:01 -07:00
|
|
|
}
|
2016-06-14 09:38:19 -04:00
|
|
|
|
|
|
|
|
type EmojiStore interface {
|
|
|
|
|
Save(emoji *model.Emoji) StoreChannel
|
2017-02-15 19:25:33 -05:00
|
|
|
Get(id string, allowFromCache bool) StoreChannel
|
2016-06-14 09:38:19 -04:00
|
|
|
GetByName(name string) StoreChannel
|
2018-01-19 09:37:59 -05:00
|
|
|
GetList(offset, limit int, sort string) StoreChannel
|
2016-06-14 09:38:19 -04:00
|
|
|
Delete(id string, time int64) StoreChannel
|
2018-01-23 11:04:44 -05:00
|
|
|
Search(name string, prefixOnly bool, limit int) StoreChannel
|
2016-06-14 09:38:19 -04:00
|
|
|
}
|
2016-07-18 11:10:03 -04:00
|
|
|
|
|
|
|
|
type StatusStore interface {
|
|
|
|
|
SaveOrUpdate(status *model.Status) StoreChannel
|
|
|
|
|
Get(userId string) StoreChannel
|
2016-10-19 14:49:25 -04:00
|
|
|
GetByIds(userIds []string) StoreChannel
|
2016-07-18 11:10:03 -04:00
|
|
|
GetOnlineAway() StoreChannel
|
2016-07-21 10:00:09 -04:00
|
|
|
GetOnline() StoreChannel
|
2016-09-06 15:48:43 -03:00
|
|
|
GetAllFromTeam(teamId string) StoreChannel
|
2016-07-18 11:10:03 -04:00
|
|
|
ResetAll() StoreChannel
|
|
|
|
|
GetTotalActiveUsersCount() StoreChannel
|
|
|
|
|
UpdateLastActivityAt(userId string, lastActivityAt int64) StoreChannel
|
|
|
|
|
}
|
2016-09-30 11:06:30 -04:00
|
|
|
|
|
|
|
|
type FileInfoStore interface {
|
|
|
|
|
Save(info *model.FileInfo) StoreChannel
|
|
|
|
|
Get(id string) StoreChannel
|
|
|
|
|
GetByPath(path string) StoreChannel
|
2017-02-20 13:40:32 -05:00
|
|
|
GetForPost(postId string, readFromMaster bool, allowFromCache bool) StoreChannel
|
2018-06-25 18:12:59 +02:00
|
|
|
GetForUser(userId string) StoreChannel
|
2017-02-07 12:36:37 -08:00
|
|
|
InvalidateFileInfosForPostCache(postId string)
|
2016-09-30 11:06:30 -04:00
|
|
|
AttachToPost(fileId string, postId string) StoreChannel
|
|
|
|
|
DeleteForPost(postId string) StoreChannel
|
2017-08-25 15:38:13 +01:00
|
|
|
PermanentDelete(fileId string) StoreChannel
|
2017-09-15 17:35:55 +01:00
|
|
|
PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
|
2018-06-25 18:12:59 +02:00
|
|
|
PermanentDeleteByUser(userId string) StoreChannel
|
2018-03-05 10:35:26 -05:00
|
|
|
ClearCaches()
|
2016-09-30 11:06:30 -04:00
|
|
|
}
|
2016-11-30 13:55:49 -05:00
|
|
|
|
|
|
|
|
type ReactionStore interface {
|
|
|
|
|
Save(reaction *model.Reaction) StoreChannel
|
|
|
|
|
Delete(reaction *model.Reaction) StoreChannel
|
2017-03-07 16:05:01 -05:00
|
|
|
GetForPost(postId string, allowFromCache bool) StoreChannel
|
2016-11-30 13:55:49 -05:00
|
|
|
DeleteAllWithEmojiName(emojiName string) StoreChannel
|
2017-09-15 17:35:55 +01:00
|
|
|
PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
|
2016-11-30 13:55:49 -05:00
|
|
|
}
|
2017-05-18 15:05:57 -04:00
|
|
|
|
2017-07-07 15:21:02 +01:00
|
|
|
type JobStore interface {
|
|
|
|
|
Save(job *model.Job) StoreChannel
|
|
|
|
|
UpdateOptimistically(job *model.Job, currentStatus string) StoreChannel
|
|
|
|
|
UpdateStatus(id string, status string) StoreChannel
|
|
|
|
|
UpdateStatusOptimistically(id string, currentStatus string, newStatus string) StoreChannel
|
2017-05-18 15:05:57 -04:00
|
|
|
Get(id string) StoreChannel
|
2017-07-20 16:25:35 +01:00
|
|
|
GetAllPage(offset int, limit int) StoreChannel
|
2017-05-18 15:05:57 -04:00
|
|
|
GetAllByType(jobType string) StoreChannel
|
|
|
|
|
GetAllByTypePage(jobType string, offset int, limit int) StoreChannel
|
2017-07-07 15:21:02 +01:00
|
|
|
GetAllByStatus(status string) StoreChannel
|
2017-09-28 17:11:13 +01:00
|
|
|
GetNewestJobByStatusAndType(status string, jobType string) StoreChannel
|
|
|
|
|
GetCountByStatusAndType(status string, jobType string) StoreChannel
|
2017-05-18 15:05:57 -04:00
|
|
|
Delete(id string) StoreChannel
|
|
|
|
|
}
|
2017-07-31 12:59:32 -04:00
|
|
|
|
|
|
|
|
type UserAccessTokenStore interface {
|
|
|
|
|
Save(token *model.UserAccessToken) StoreChannel
|
|
|
|
|
Delete(tokenId string) StoreChannel
|
|
|
|
|
DeleteAllForUser(userId string) StoreChannel
|
|
|
|
|
Get(tokenId string) StoreChannel
|
2018-01-05 14:46:48 -05:00
|
|
|
GetAll(offset int, limit int) StoreChannel
|
2017-07-31 12:59:32 -04:00
|
|
|
GetByToken(tokenString string) StoreChannel
|
|
|
|
|
GetByUser(userId string, page, perPage int) StoreChannel
|
2018-01-11 16:30:55 -05:00
|
|
|
Search(term string) StoreChannel
|
2017-10-19 08:10:29 -04:00
|
|
|
UpdateTokenEnable(tokenId string) StoreChannel
|
|
|
|
|
UpdateTokenDisable(tokenId string) StoreChannel
|
2017-07-31 12:59:32 -04:00
|
|
|
}
|
2017-11-27 17:23:35 -05:00
|
|
|
|
|
|
|
|
type PluginStore interface {
|
|
|
|
|
SaveOrUpdate(keyVal *model.PluginKeyValue) StoreChannel
|
|
|
|
|
Get(pluginId, key string) StoreChannel
|
|
|
|
|
Delete(pluginId, key string) StoreChannel
|
|
|
|
|
}
|
2018-02-06 15:34:08 +00:00
|
|
|
|
|
|
|
|
type RoleStore interface {
|
|
|
|
|
Save(role *model.Role) StoreChannel
|
|
|
|
|
Get(roleId string) StoreChannel
|
|
|
|
|
GetByName(name string) StoreChannel
|
|
|
|
|
GetByNames(names []string) StoreChannel
|
2018-04-20 19:49:13 +01:00
|
|
|
Delete(roldId string) StoreChannel
|
2018-04-18 10:18:07 +01:00
|
|
|
PermanentDeleteAll() StoreChannel
|
2018-02-06 15:34:08 +00:00
|
|
|
}
|
2018-04-20 19:49:13 +01:00
|
|
|
|
|
|
|
|
type SchemeStore interface {
|
|
|
|
|
Save(scheme *model.Scheme) StoreChannel
|
|
|
|
|
Get(schemeId string) StoreChannel
|
2018-06-21 12:02:35 +01:00
|
|
|
GetByName(schemeName string) StoreChannel
|
2018-05-03 14:00:26 +01:00
|
|
|
GetAllPage(scope string, offset int, limit int) StoreChannel
|
2018-04-20 19:49:13 +01:00
|
|
|
Delete(schemeId string) StoreChannel
|
2018-05-17 16:28:14 +01:00
|
|
|
PermanentDeleteAll() StoreChannel
|
2018-04-20 19:49:13 +01:00
|
|
|
}
|