This commit redesigns the jobserver to be based around an architecture of "workers", which carry out jobs of a particular type, and "jobs" which are a unit of work carried by a particular worker. It also introduces "schedulers" which are responsible for scheduling jobs of a particular type automatically (jobs can also be scheduled manually when apropriate). Workers may be run many times, either in instances of the platform binary, or the standalone jobserver binary. In any mattermost cluster, only one instance of platform OR jobserver must run the schedulers. At the moment this is controlled by a config variable, but in future will be controlled through the cluster leader election process.
84 строки
2.6 KiB
Go
84 строки
2.6 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package store
|
|
|
|
import (
|
|
_ "github.com/go-sql-driver/mysql"
|
|
_ "github.com/lib/pq"
|
|
"github.com/mattermost/gorp"
|
|
)
|
|
|
|
/*type SqlStore struct {
|
|
master *gorp.DbMap
|
|
replicas []*gorp.DbMap
|
|
searchReplicas []*gorp.DbMap
|
|
team TeamStore
|
|
channel ChannelStore
|
|
post PostStore
|
|
user UserStore
|
|
audit AuditStore
|
|
compliance ComplianceStore
|
|
session SessionStore
|
|
oauth OAuthStore
|
|
system SystemStore
|
|
webhook WebhookStore
|
|
command CommandStore
|
|
preference PreferenceStore
|
|
license LicenseStore
|
|
token TokenStore
|
|
emoji EmojiStore
|
|
status StatusStore
|
|
fileInfo FileInfoStore
|
|
reaction ReactionStore
|
|
jobStatus JobStatusStore
|
|
SchemaVersion string
|
|
rrCounter int64
|
|
srCounter int64
|
|
}*/
|
|
|
|
type SqlStore interface {
|
|
GetCurrentSchemaVersion() string
|
|
GetMaster() *gorp.DbMap
|
|
GetSearchReplica() *gorp.DbMap
|
|
GetReplica() *gorp.DbMap
|
|
TotalMasterDbConnections() int
|
|
TotalReadDbConnections() int
|
|
TotalSearchDbConnections() int
|
|
MarkSystemRanUnitTests()
|
|
DoesTableExist(tablename string) bool
|
|
DoesColumnExist(tableName string, columName string) bool
|
|
CreateColumnIfNotExists(tableName string, columnName string, mySqlColType string, postgresColType string, defaultValue string) bool
|
|
RemoveColumnIfExists(tableName string, columnName string) bool
|
|
RemoveTableIfExists(tableName string) bool
|
|
RenameColumnIfExists(tableName string, oldColumnName string, newColumnName string, colType string) bool
|
|
GetMaxLengthOfColumnIfExists(tableName string, columnName string) string
|
|
AlterColumnTypeIfExists(tableName string, columnName string, mySqlColType string, postgresColType string) bool
|
|
CreateUniqueIndexIfNotExists(indexName string, tableName string, columnName string) bool
|
|
CreateIndexIfNotExists(indexName string, tableName string, columnName string) bool
|
|
CreateFullTextIndexIfNotExists(indexName string, tableName string, columnName string) bool
|
|
RemoveIndexIfExists(indexName string, tableName string) bool
|
|
GetAllConns() []*gorp.DbMap
|
|
Close()
|
|
Team() TeamStore
|
|
Channel() ChannelStore
|
|
Post() PostStore
|
|
User() UserStore
|
|
Audit() AuditStore
|
|
ClusterDiscovery() ClusterDiscoveryStore
|
|
Compliance() ComplianceStore
|
|
Session() SessionStore
|
|
OAuth() OAuthStore
|
|
System() SystemStore
|
|
Webhook() WebhookStore
|
|
Command() CommandStore
|
|
Preference() PreferenceStore
|
|
License() LicenseStore
|
|
Token() TokenStore
|
|
Emoji() EmojiStore
|
|
Status() StatusStore
|
|
FileInfo() FileInfoStore
|
|
Reaction() ReactionStore
|
|
Job() JobStore
|
|
}
|