diff options
author | George Goldberg <george@gberg.me> | 2017-07-07 15:21:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-07 15:21:02 +0100 |
commit | 0495a519499d6cefa289982a94d8f42de541c1f0 (patch) | |
tree | 94b6145daa41ca4d1d4a172f030071076852a09a /store/store.go | |
parent | 6e0f5f096986dad11ef182ddb51d4bfb0e558860 (diff) | |
download | chat-0495a519499d6cefa289982a94d8f42de541c1f0.tar.gz chat-0495a519499d6cefa289982a94d8f42de541c1f0.tar.bz2 chat-0495a519499d6cefa289982a94d8f42de541c1f0.zip |
PLT-6916: Redesign the jobs package and Jobserver. (#6733)
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.
Diffstat (limited to 'store/store.go')
-rw-r--r-- | store/store.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/store/store.go b/store/store.go index 0007f495e..95496b609 100644 --- a/store/store.go +++ b/store/store.go @@ -48,7 +48,7 @@ type Store interface { Status() StatusStore FileInfo() FileInfoStore Reaction() ReactionStore - JobStatus() JobStatusStore + Job() JobStore MarkSystemRanUnitTests() Close() DropAllTables() @@ -384,10 +384,14 @@ type ReactionStore interface { DeleteAllWithEmojiName(emojiName string) StoreChannel } -type JobStatusStore interface { - SaveOrUpdate(status *model.JobStatus) StoreChannel +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 Get(id string) StoreChannel GetAllByType(jobType string) StoreChannel GetAllByTypePage(jobType string, offset int, limit int) StoreChannel + GetAllByStatus(status string) StoreChannel Delete(id string) StoreChannel } |