store: add {Push,Pop}Compose methods and hide channel

Wrap the channel in Pop and Push methods, so it is not exposed to
the callers. PushCompose replaces the old AddCompose for consistency,
and PopCompose simply reads from the other end of the channel.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-10-05 17:51:30 +02:00 committed by Lars Karlitski
parent 3ff4f59fc7
commit 9cb140795e
6 changed files with 23 additions and 37 deletions

View file

@ -8,7 +8,6 @@ import (
"path/filepath"
"osbuild-composer/internal/blueprint"
"osbuild-composer/internal/job"
"osbuild-composer/internal/jobqueue"
"osbuild-composer/internal/rpmmd"
"osbuild-composer/internal/store"
@ -63,9 +62,8 @@ func main() {
}
stateChannel := make(chan []byte, 10)
jobChannel := make(chan job.Job, 200)
store := store.New(state, stateChannel, jobChannel)
store := store.New(state, stateChannel)
// sample blueprint on first run
if state == nil {
store.PushBlueprint(blueprint.Blueprint{
@ -77,7 +75,7 @@ func main() {
})
}
jobAPI := jobqueue.New(logger, store, jobChannel)
jobAPI := jobqueue.New(logger, store)
weldrAPI := weldr.New(repo, packages, logger, store)
go func() {
for {