Mercurial > gemma
comparison pkg/imports/queue.go @ 1193:58acc343b1b6
Implemented the db stuff of the review process. Needs testing.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 16 Nov 2018 18:35:09 +0100 |
parents | e3de65179889 |
children | cabf4789e02b |
comparison
equal
deleted
inserted
replaced
1192:3afa71405b87 | 1193:58acc343b1b6 |
---|---|
43 JobKind string | 43 JobKind string |
44 | 44 |
45 JobCreator interface { | 45 JobCreator interface { |
46 Create(kind JobKind, data string) (Job, error) | 46 Create(kind JobKind, data string) (Job, error) |
47 Depends() []string | 47 Depends() []string |
48 StageDone(*sql.Tx, context.Context, int64) error | |
48 } | 49 } |
49 | 50 |
50 idJob struct { | 51 idJob struct { |
51 id int64 | 52 id int64 |
52 kind JobKind | 53 kind JobKind |
139 q.creatorsMu.Lock() | 140 q.creatorsMu.Lock() |
140 defer q.creatorsMu.Unlock() | 141 defer q.creatorsMu.Unlock() |
141 q.creators[kind] = jc | 142 q.creators[kind] = jc |
142 } | 143 } |
143 | 144 |
145 func FindJobCreator(kind JobKind) JobCreator { | |
146 return iqueue.jobCreator(kind) | |
147 } | |
148 | |
144 func RegisterJobCreator(kind JobKind, jc JobCreator) { | 149 func RegisterJobCreator(kind JobKind, jc JobCreator) { |
145 log.Printf("info: register import job creator for kind '%s'\n", kind) | 150 log.Printf("info: register import job creator for kind '%s'\n", kind) |
146 iqueue.registerJobCreator(kind, jc) | 151 iqueue.registerJobCreator(kind, jc) |
147 } | 152 } |
148 | 153 |