github.com/qichengzx/mattermost-server@v4.5.1-0.20180604164826-2c75247c97d0+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  	Audit() AuditStore
    47  	ClusterDiscovery() ClusterDiscoveryStore
    48  	Compliance() ComplianceStore
    49  	Session() SessionStore
    50  	OAuth() OAuthStore
    51  	System() SystemStore
    52  	Webhook() WebhookStore
    53  	Command() CommandStore
    54  	CommandWebhook() CommandWebhookStore
    55  	Preference() PreferenceStore
    56  	License() LicenseStore
    57  	Token() TokenStore
    58  	Emoji() EmojiStore
    59  	Status() StatusStore
    60  	FileInfo() FileInfoStore
    61  	Reaction() ReactionStore
    62  	Role() RoleStore
    63  	Scheme() SchemeStore
    64  	Job() JobStore
    65  	UserAccessToken() UserAccessTokenStore
    66  	ChannelMemberHistory() ChannelMemberHistoryStore
    67  	Plugin() PluginStore
    68  	MarkSystemRanUnitTests()
    69  	Close()
    70  	DropAllTables()
    71  	TotalMasterDbConnections() int
    72  	TotalReadDbConnections() int
    73  	TotalSearchDbConnections() int
    74  }
    75  
    76  type TeamStore interface {
    77  	Save(team *model.Team) StoreChannel
    78  	Update(team *model.Team) StoreChannel
    79  	UpdateDisplayName(name string, teamId string) StoreChannel
    80  	Get(id string) StoreChannel
    81  	GetByName(name string) StoreChannel
    82  	SearchByName(name string) StoreChannel
    83  	SearchAll(term string) StoreChannel
    84  	SearchOpen(term string) StoreChannel
    85  	GetAll() StoreChannel
    86  	GetAllPage(offset int, limit int) StoreChannel
    87  	GetAllTeamListing() StoreChannel
    88  	GetAllTeamPageListing(offset int, limit int) StoreChannel
    89  	GetTeamsByUserId(userId string) StoreChannel
    90  	GetByInviteId(inviteId string) StoreChannel
    91  	PermanentDelete(teamId string) StoreChannel
    92  	AnalyticsTeamCount() StoreChannel
    93  	SaveMember(member *model.TeamMember, maxUsersPerTeam int) StoreChannel
    94  	UpdateMember(member *model.TeamMember) StoreChannel
    95  	GetMember(teamId string, userId string) StoreChannel
    96  	GetMembers(teamId string, offset int, limit int) StoreChannel
    97  	GetMembersByIds(teamId string, userIds []string) StoreChannel
    98  	GetTotalMemberCount(teamId string) StoreChannel
    99  	GetActiveMemberCount(teamId string) StoreChannel
   100  	GetTeamsForUser(userId string) StoreChannel
   101  	GetChannelUnreadsForAllTeams(excludeTeamId, userId string) StoreChannel
   102  	GetChannelUnreadsForTeam(teamId, userId string) StoreChannel
   103  	RemoveMember(teamId string, userId string) StoreChannel
   104  	RemoveAllMembersByTeam(teamId string) StoreChannel
   105  	RemoveAllMembersByUser(userId string) StoreChannel
   106  	UpdateLastTeamIconUpdate(teamId string, curTime int64) StoreChannel
   107  	GetTeamsByScheme(schemeId string, offset int, limit int) StoreChannel
   108  	MigrateTeamMembers(fromTeamId string, fromUserId string) StoreChannel
   109  	ResetAllTeamSchemes() StoreChannel
   110  }
   111  
   112  type ChannelStore interface {
   113  	Save(channel *model.Channel, maxChannelsPerTeam int64) StoreChannel
   114  	CreateDirectChannel(userId string, otherUserId string) StoreChannel
   115  	SaveDirectChannel(channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) StoreChannel
   116  	Update(channel *model.Channel) StoreChannel
   117  	Get(id string, allowFromCache bool) StoreChannel
   118  	InvalidateChannel(id string)
   119  	InvalidateChannelByName(teamId, name string)
   120  	GetFromMaster(id string) StoreChannel
   121  	Delete(channelId string, time int64) StoreChannel
   122  	Restore(channelId string, time int64) StoreChannel
   123  	SetDeleteAt(channelId string, deleteAt int64, updateAt int64) StoreChannel
   124  	PermanentDeleteByTeam(teamId string) StoreChannel
   125  	PermanentDelete(channelId string) StoreChannel
   126  	GetByName(team_id string, name string, allowFromCache bool) StoreChannel
   127  	GetByNames(team_id string, names []string, allowFromCache bool) StoreChannel
   128  	GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) StoreChannel
   129  	GetDeletedByName(team_id string, name string) StoreChannel
   130  	GetDeleted(team_id string, offset int, limit int) StoreChannel
   131  	GetChannels(teamId string, userId string) StoreChannel
   132  	GetMoreChannels(teamId string, userId string, offset int, limit int) StoreChannel
   133  	GetPublicChannelsForTeam(teamId string, offset int, limit int) StoreChannel
   134  	GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) StoreChannel
   135  	GetChannelCounts(teamId string, userId string) StoreChannel
   136  	GetTeamChannels(teamId string) StoreChannel
   137  	GetAll(teamId string) StoreChannel
   138  	GetForPost(postId string) StoreChannel
   139  	SaveMember(member *model.ChannelMember) StoreChannel
   140  	UpdateMember(member *model.ChannelMember) StoreChannel
   141  	GetMembers(channelId string, offset, limit int) StoreChannel
   142  	GetMember(channelId string, userId string) StoreChannel
   143  	GetAllChannelMembersForUser(userId string, allowFromCache bool) StoreChannel
   144  	InvalidateAllChannelMembersForUser(userId string)
   145  	IsUserInChannelUseCache(userId string, channelId string) bool
   146  	GetAllChannelMembersNotifyPropsForChannel(channelId string, allowFromCache bool) StoreChannel
   147  	InvalidateCacheForChannelMembersNotifyProps(channelId string)
   148  	GetMemberForPost(postId string, userId string) StoreChannel
   149  	InvalidateMemberCount(channelId string)
   150  	GetMemberCountFromCache(channelId string) int64
   151  	GetMemberCount(channelId string, allowFromCache bool) StoreChannel
   152  	GetPinnedPosts(channelId string) StoreChannel
   153  	RemoveMember(channelId string, userId string) StoreChannel
   154  	PermanentDeleteMembersByUser(userId string) StoreChannel
   155  	PermanentDeleteMembersByChannel(channelId string) StoreChannel
   156  	UpdateLastViewedAt(channelIds []string, userId string) StoreChannel
   157  	IncrementMentionCount(channelId string, userId string) StoreChannel
   158  	AnalyticsTypeCount(teamId string, channelType string) StoreChannel
   159  	GetMembersForUser(teamId string, userId string) StoreChannel
   160  	AutocompleteInTeam(teamId string, term string) StoreChannel
   161  	SearchInTeam(teamId string, term string) StoreChannel
   162  	SearchMore(userId string, teamId string, term string) StoreChannel
   163  	GetMembersByIds(channelId string, userIds []string) StoreChannel
   164  	AnalyticsDeletedTypeCount(teamId string, channelType string) StoreChannel
   165  	GetChannelUnread(channelId, userId string) StoreChannel
   166  	ClearCaches()
   167  	GetChannelsByScheme(schemeId string, offset int, limit int) StoreChannel
   168  	MigrateChannelMembers(fromChannelId string, fromUserId string) StoreChannel
   169  	ResetAllChannelSchemes() StoreChannel
   170  }
   171  
   172  type ChannelMemberHistoryStore interface {
   173  	LogJoinEvent(userId string, channelId string, joinTime int64) StoreChannel
   174  	LogLeaveEvent(userId string, channelId string, leaveTime int64) StoreChannel
   175  	GetUsersInChannelDuring(startTime int64, endTime int64, channelId string) StoreChannel
   176  	PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
   177  }
   178  
   179  type PostStore interface {
   180  	Save(post *model.Post) StoreChannel
   181  	Update(newPost *model.Post, oldPost *model.Post) StoreChannel
   182  	Get(id string) StoreChannel
   183  	GetSingle(id string) StoreChannel
   184  	Delete(postId string, time int64, deleteByID string) StoreChannel
   185  	PermanentDeleteByUser(userId string) StoreChannel
   186  	PermanentDeleteByChannel(channelId string) StoreChannel
   187  	GetPosts(channelId string, offset int, limit int, allowFromCache bool) StoreChannel
   188  	GetFlaggedPosts(userId string, offset int, limit int) StoreChannel
   189  	GetFlaggedPostsForTeam(userId, teamId string, offset int, limit int) StoreChannel
   190  	GetFlaggedPostsForChannel(userId, channelId string, offset int, limit int) StoreChannel
   191  	GetPostsBefore(channelId string, postId string, numPosts int, offset int) StoreChannel
   192  	GetPostsAfter(channelId string, postId string, numPosts int, offset int) StoreChannel
   193  	GetPostsSince(channelId string, time int64, allowFromCache bool) StoreChannel
   194  	GetEtag(channelId string, allowFromCache bool) StoreChannel
   195  	Search(teamId string, userId string, params *model.SearchParams) StoreChannel
   196  	AnalyticsUserCountsWithPostsByDay(teamId string) StoreChannel
   197  	AnalyticsPostCountsByDay(teamId string) StoreChannel
   198  	AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) StoreChannel
   199  	ClearCaches()
   200  	InvalidateLastPostTimeCache(channelId string)
   201  	GetPostsCreatedAt(channelId string, time int64) StoreChannel
   202  	Overwrite(post *model.Post) StoreChannel
   203  	GetPostsByIds(postIds []string) StoreChannel
   204  	GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) StoreChannel
   205  	PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
   206  	GetOldest() StoreChannel
   207  	GetMaxPostSize() StoreChannel
   208  }
   209  
   210  type UserStore interface {
   211  	Save(user *model.User) StoreChannel
   212  	Update(user *model.User, allowRoleUpdate bool) StoreChannel
   213  	UpdateLastPictureUpdate(userId string) StoreChannel
   214  	UpdateUpdateAt(userId string) StoreChannel
   215  	UpdatePassword(userId, newPassword string) StoreChannel
   216  	UpdateAuthData(userId string, service string, authData *string, email string, resetMfa bool) StoreChannel
   217  	UpdateMfaSecret(userId, secret string) StoreChannel
   218  	UpdateMfaActive(userId string, active bool) StoreChannel
   219  	Get(id string) StoreChannel
   220  	GetAll() StoreChannel
   221  	ClearCaches()
   222  	InvalidateProfilesInChannelCacheByUser(userId string)
   223  	InvalidateProfilesInChannelCache(channelId string)
   224  	GetProfilesInChannel(channelId string, offset int, limit int) StoreChannel
   225  	GetProfilesInChannelByStatus(channelId string, offset int, limit int) StoreChannel
   226  	GetAllProfilesInChannel(channelId string, allowFromCache bool) StoreChannel
   227  	GetProfilesNotInChannel(teamId string, channelId string, offset int, limit int) StoreChannel
   228  	GetProfilesWithoutTeam(offset int, limit int) StoreChannel
   229  	GetProfilesByUsernames(usernames []string, teamId string) StoreChannel
   230  	GetAllProfiles(offset int, limit int) StoreChannel
   231  	GetProfiles(teamId string, offset int, limit int) StoreChannel
   232  	GetProfileByIds(userId []string, allowFromCache bool) StoreChannel
   233  	InvalidatProfileCacheForUser(userId string)
   234  	GetByEmail(email string) StoreChannel
   235  	GetByAuth(authData *string, authService string) StoreChannel
   236  	GetAllUsingAuthService(authService string) StoreChannel
   237  	GetByUsername(username string) StoreChannel
   238  	GetForLogin(loginId string, allowSignInWithUsername, allowSignInWithEmail bool) StoreChannel
   239  	VerifyEmail(userId string) StoreChannel
   240  	GetEtagForAllProfiles() StoreChannel
   241  	GetEtagForProfiles(teamId string) StoreChannel
   242  	UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel
   243  	GetTotalUsersCount() StoreChannel
   244  	GetSystemAdminProfiles() StoreChannel
   245  	PermanentDelete(userId string) StoreChannel
   246  	AnalyticsUniqueUserCount(teamId string) StoreChannel
   247  	AnalyticsActiveCount(time int64) StoreChannel
   248  	GetUnreadCount(userId string) StoreChannel
   249  	GetUnreadCountForChannel(userId string, channelId string) StoreChannel
   250  	GetRecentlyActiveUsersForTeam(teamId string, offset, limit int) StoreChannel
   251  	GetNewUsersForTeam(teamId string, offset, limit int) StoreChannel
   252  	Search(teamId string, term string, options map[string]bool) StoreChannel
   253  	SearchNotInTeam(notInTeamId string, term string, options map[string]bool) StoreChannel
   254  	SearchInChannel(channelId string, term string, options map[string]bool) StoreChannel
   255  	SearchNotInChannel(teamId string, channelId string, term string, options map[string]bool) StoreChannel
   256  	SearchWithoutTeam(term string, options map[string]bool) StoreChannel
   257  	AnalyticsGetInactiveUsersCount() StoreChannel
   258  	AnalyticsGetSystemAdminCount() StoreChannel
   259  	GetProfilesNotInTeam(teamId string, offset int, limit int) StoreChannel
   260  	GetEtagForProfilesNotInTeam(teamId string) StoreChannel
   261  }
   262  
   263  type SessionStore interface {
   264  	Save(session *model.Session) StoreChannel
   265  	Get(sessionIdOrToken string) StoreChannel
   266  	GetSessions(userId string) StoreChannel
   267  	GetSessionsWithActiveDeviceIds(userId string) StoreChannel
   268  	Remove(sessionIdOrToken string) StoreChannel
   269  	RemoveAllSessions() StoreChannel
   270  	PermanentDeleteSessionsByUser(teamId string) StoreChannel
   271  	UpdateLastActivityAt(sessionId string, time int64) StoreChannel
   272  	UpdateRoles(userId string, roles string) StoreChannel
   273  	UpdateDeviceId(id string, deviceId string, expiresAt int64) StoreChannel
   274  	AnalyticsSessionCount() StoreChannel
   275  	Cleanup(expiryTime int64, batchSize int64)
   276  }
   277  
   278  type AuditStore interface {
   279  	Save(audit *model.Audit) StoreChannel
   280  	Get(user_id string, offset int, limit int) StoreChannel
   281  	PermanentDeleteByUser(userId string) StoreChannel
   282  	PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
   283  }
   284  
   285  type ClusterDiscoveryStore interface {
   286  	Save(discovery *model.ClusterDiscovery) StoreChannel
   287  	Delete(discovery *model.ClusterDiscovery) StoreChannel
   288  	Exists(discovery *model.ClusterDiscovery) StoreChannel
   289  	GetAll(discoveryType, clusterName string) StoreChannel
   290  	SetLastPingAt(discovery *model.ClusterDiscovery) StoreChannel
   291  	Cleanup() StoreChannel
   292  }
   293  
   294  type ComplianceStore interface {
   295  	Save(compliance *model.Compliance) StoreChannel
   296  	Update(compliance *model.Compliance) StoreChannel
   297  	Get(id string) StoreChannel
   298  	GetAll(offset, limit int) StoreChannel
   299  	ComplianceExport(compliance *model.Compliance) StoreChannel
   300  	MessageExport(after int64, limit int) StoreChannel
   301  }
   302  
   303  type OAuthStore interface {
   304  	SaveApp(app *model.OAuthApp) StoreChannel
   305  	UpdateApp(app *model.OAuthApp) StoreChannel
   306  	GetApp(id string) StoreChannel
   307  	GetAppByUser(userId string, offset, limit int) StoreChannel
   308  	GetApps(offset, limit int) StoreChannel
   309  	GetAuthorizedApps(userId string, offset, limit int) StoreChannel
   310  	DeleteApp(id string) StoreChannel
   311  	SaveAuthData(authData *model.AuthData) StoreChannel
   312  	GetAuthData(code string) StoreChannel
   313  	RemoveAuthData(code string) StoreChannel
   314  	PermanentDeleteAuthDataByUser(userId string) StoreChannel
   315  	SaveAccessData(accessData *model.AccessData) StoreChannel
   316  	UpdateAccessData(accessData *model.AccessData) StoreChannel
   317  	GetAccessData(token string) StoreChannel
   318  	GetAccessDataByUserForApp(userId, clientId string) StoreChannel
   319  	GetAccessDataByRefreshToken(token string) StoreChannel
   320  	GetPreviousAccessData(userId, clientId string) StoreChannel
   321  	RemoveAccessData(token string) StoreChannel
   322  }
   323  
   324  type SystemStore interface {
   325  	Save(system *model.System) StoreChannel
   326  	SaveOrUpdate(system *model.System) StoreChannel
   327  	Update(system *model.System) StoreChannel
   328  	Get() StoreChannel
   329  	GetByName(name string) StoreChannel
   330  	PermanentDeleteByName(name string) StoreChannel
   331  }
   332  
   333  type WebhookStore interface {
   334  	SaveIncoming(webhook *model.IncomingWebhook) StoreChannel
   335  	GetIncoming(id string, allowFromCache bool) StoreChannel
   336  	GetIncomingList(offset, limit int) StoreChannel
   337  	GetIncomingByTeam(teamId string, offset, limit int) StoreChannel
   338  	UpdateIncoming(webhook *model.IncomingWebhook) StoreChannel
   339  	GetIncomingByChannel(channelId string) StoreChannel
   340  	DeleteIncoming(webhookId string, time int64) StoreChannel
   341  	PermanentDeleteIncomingByChannel(channelId string) StoreChannel
   342  	PermanentDeleteIncomingByUser(userId string) StoreChannel
   343  
   344  	SaveOutgoing(webhook *model.OutgoingWebhook) StoreChannel
   345  	GetOutgoing(id string) StoreChannel
   346  	GetOutgoingList(offset, limit int) StoreChannel
   347  	GetOutgoingByChannel(channelId string, offset, limit int) StoreChannel
   348  	GetOutgoingByTeam(teamId string, offset, limit int) StoreChannel
   349  	DeleteOutgoing(webhookId string, time int64) StoreChannel
   350  	PermanentDeleteOutgoingByChannel(channelId string) StoreChannel
   351  	PermanentDeleteOutgoingByUser(userId string) StoreChannel
   352  	UpdateOutgoing(hook *model.OutgoingWebhook) StoreChannel
   353  
   354  	AnalyticsIncomingCount(teamId string) StoreChannel
   355  	AnalyticsOutgoingCount(teamId string) StoreChannel
   356  	InvalidateWebhookCache(webhook string)
   357  	ClearCaches()
   358  }
   359  
   360  type CommandStore interface {
   361  	Save(webhook *model.Command) StoreChannel
   362  	Get(id string) StoreChannel
   363  	GetByTeam(teamId string) StoreChannel
   364  	GetByTrigger(teamId string, trigger string) StoreChannel
   365  	Delete(commandId string, time int64) StoreChannel
   366  	PermanentDeleteByTeam(teamId string) StoreChannel
   367  	PermanentDeleteByUser(userId string) StoreChannel
   368  	Update(hook *model.Command) StoreChannel
   369  	AnalyticsCommandCount(teamId string) StoreChannel
   370  }
   371  
   372  type CommandWebhookStore interface {
   373  	Save(webhook *model.CommandWebhook) StoreChannel
   374  	Get(id string) StoreChannel
   375  	TryUse(id string, limit int) StoreChannel
   376  	Cleanup()
   377  }
   378  
   379  type PreferenceStore interface {
   380  	Save(preferences *model.Preferences) StoreChannel
   381  	Get(userId string, category string, name string) StoreChannel
   382  	GetCategory(userId string, category string) StoreChannel
   383  	GetAll(userId string) StoreChannel
   384  	Delete(userId, category, name string) StoreChannel
   385  	DeleteCategory(userId string, category string) StoreChannel
   386  	DeleteCategoryAndName(category string, name string) StoreChannel
   387  	PermanentDeleteByUser(userId string) StoreChannel
   388  	IsFeatureEnabled(feature, userId string) StoreChannel
   389  	CleanupFlagsBatch(limit int64) StoreChannel
   390  }
   391  
   392  type LicenseStore interface {
   393  	Save(license *model.LicenseRecord) StoreChannel
   394  	Get(id string) StoreChannel
   395  }
   396  
   397  type TokenStore interface {
   398  	Save(recovery *model.Token) StoreChannel
   399  	Delete(token string) StoreChannel
   400  	GetByToken(token string) StoreChannel
   401  	Cleanup()
   402  }
   403  
   404  type EmojiStore interface {
   405  	Save(emoji *model.Emoji) StoreChannel
   406  	Get(id string, allowFromCache bool) StoreChannel
   407  	GetByName(name string) StoreChannel
   408  	GetList(offset, limit int, sort string) StoreChannel
   409  	Delete(id string, time int64) StoreChannel
   410  	Search(name string, prefixOnly bool, limit int) StoreChannel
   411  }
   412  
   413  type StatusStore interface {
   414  	SaveOrUpdate(status *model.Status) StoreChannel
   415  	Get(userId string) StoreChannel
   416  	GetByIds(userIds []string) StoreChannel
   417  	GetOnlineAway() StoreChannel
   418  	GetOnline() StoreChannel
   419  	GetAllFromTeam(teamId string) StoreChannel
   420  	ResetAll() StoreChannel
   421  	GetTotalActiveUsersCount() StoreChannel
   422  	UpdateLastActivityAt(userId string, lastActivityAt int64) StoreChannel
   423  }
   424  
   425  type FileInfoStore interface {
   426  	Save(info *model.FileInfo) StoreChannel
   427  	Get(id string) StoreChannel
   428  	GetByPath(path string) StoreChannel
   429  	GetForPost(postId string, readFromMaster bool, allowFromCache bool) StoreChannel
   430  	InvalidateFileInfosForPostCache(postId string)
   431  	AttachToPost(fileId string, postId string) StoreChannel
   432  	DeleteForPost(postId string) StoreChannel
   433  	PermanentDelete(fileId string) StoreChannel
   434  	PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
   435  	ClearCaches()
   436  }
   437  
   438  type ReactionStore interface {
   439  	Save(reaction *model.Reaction) StoreChannel
   440  	Delete(reaction *model.Reaction) StoreChannel
   441  	GetForPost(postId string, allowFromCache bool) StoreChannel
   442  	DeleteAllWithEmojiName(emojiName string) StoreChannel
   443  	PermanentDeleteBatch(endTime int64, limit int64) StoreChannel
   444  }
   445  
   446  type JobStore interface {
   447  	Save(job *model.Job) StoreChannel
   448  	UpdateOptimistically(job *model.Job, currentStatus string) StoreChannel
   449  	UpdateStatus(id string, status string) StoreChannel
   450  	UpdateStatusOptimistically(id string, currentStatus string, newStatus string) StoreChannel
   451  	Get(id string) StoreChannel
   452  	GetAllPage(offset int, limit int) StoreChannel
   453  	GetAllByType(jobType string) StoreChannel
   454  	GetAllByTypePage(jobType string, offset int, limit int) StoreChannel
   455  	GetAllByStatus(status string) StoreChannel
   456  	GetNewestJobByStatusAndType(status string, jobType string) StoreChannel
   457  	GetCountByStatusAndType(status string, jobType string) StoreChannel
   458  	Delete(id string) StoreChannel
   459  }
   460  
   461  type UserAccessTokenStore interface {
   462  	Save(token *model.UserAccessToken) StoreChannel
   463  	Delete(tokenId string) StoreChannel
   464  	DeleteAllForUser(userId string) StoreChannel
   465  	Get(tokenId string) StoreChannel
   466  	GetAll(offset int, limit int) StoreChannel
   467  	GetByToken(tokenString string) StoreChannel
   468  	GetByUser(userId string, page, perPage int) StoreChannel
   469  	Search(term string) StoreChannel
   470  	UpdateTokenEnable(tokenId string) StoreChannel
   471  	UpdateTokenDisable(tokenId string) StoreChannel
   472  }
   473  
   474  type PluginStore interface {
   475  	SaveOrUpdate(keyVal *model.PluginKeyValue) StoreChannel
   476  	Get(pluginId, key string) StoreChannel
   477  	Delete(pluginId, key string) StoreChannel
   478  }
   479  
   480  type RoleStore interface {
   481  	Save(role *model.Role) StoreChannel
   482  	Get(roleId string) StoreChannel
   483  	GetByName(name string) StoreChannel
   484  	GetByNames(names []string) StoreChannel
   485  	Delete(roldId string) StoreChannel
   486  	PermanentDeleteAll() StoreChannel
   487  }
   488  
   489  type SchemeStore interface {
   490  	Save(scheme *model.Scheme) StoreChannel
   491  	Get(schemeId string) StoreChannel
   492  	GetAllPage(scope string, offset int, limit int) StoreChannel
   493  	Delete(schemeId string) StoreChannel
   494  	PermanentDeleteAll() StoreChannel
   495  }