Mercurial > gemma
diff pkg/imports/queue.go @ 1495:d26e3e1fcff1
The global import queue already knows which kinds of imports it supports.
So there is no need to have another table to track these as a list.
This is only a thing which can async potentially. So this list is removed.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 04 Dec 2018 18:20:31 +0100 |
parents | 74b0df86b6e6 |
children | b41ad15cc55f |
line wrap: on
line diff
--- a/pkg/imports/queue.go Tue Dec 04 17:56:28 2018 +0100 +++ b/pkg/imports/queue.go Tue Dec 04 18:20:31 2018 +0100 @@ -153,11 +153,28 @@ return iqueue.jobCreator(kind) } +func ImportKindNames() []string { + return iqueue.importKindNames() +} + func RegisterJobCreator(kind JobKind, jc JobCreator) { log.Printf("info: register import job creator for kind '%s'\n", kind) iqueue.registerJobCreator(kind, jc) } +func (q *importQueue) importKindNames() []string { + q.creatorsMu.Lock() + defer q.creatorsMu.Unlock() + names := make([]string, len(q.creators)) + var i int + for kind := range q.creators { + names[i] = string(kind) + i++ + } + // XXX: Consider using sort.Strings to make output deterministic. + return names +} + func (q *importQueue) jobCreator(kind JobKind) JobCreator { q.creatorsMu.Lock() defer q.creatorsMu.Unlock()