store: add image struct into compose struct
As a part of f4991cb1 ComposeEntry struct was removed from store package.
This change made sense because this struct is connected more with API than
with store - store uses its own Compose struct. In addition, converters
between Compose and ComposeEntry were added. Unfortunately, ComposeEntry
contains ImageSize which was not stored in Compose but retrieved from store
using GetImage method. This made those converters dependent on the store,
which was messy.
To solve this issue this commit adds image struct into Compose struct.
The content of image struct is generated on the worker side - when the worker
sets the compose status to FINISHED, it also sends Image struct with detailed
information about the result.
This commit is contained in:
parent
b2880cacc6
commit
f89a9671be
7 changed files with 127 additions and 88 deletions
|
|
@ -3,6 +3,7 @@ package weldr
|
|||
import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/osbuild/osbuild-composer/internal/store"
|
||||
"log"
|
||||
"sort"
|
||||
)
|
||||
|
||||
|
|
@ -41,13 +42,13 @@ func composeToComposeEntry(id uuid.UUID, compose store.Compose, includeUploads b
|
|||
composeEntry.JobStarted = float64(compose.JobStarted.UnixNano()) / 1000000000
|
||||
|
||||
case "FINISHED":
|
||||
//image, err := s.GetImage(id)
|
||||
//imageSize := int64(0)
|
||||
//if err == nil {
|
||||
// imageSize = image.Size
|
||||
//}
|
||||
// TODO: this is currently broken!
|
||||
composeEntry.ImageSize = int64(0)
|
||||
if compose.Image != nil {
|
||||
composeEntry.ImageSize = compose.Image.Size
|
||||
} else {
|
||||
log.Printf("finished compose with id %s has nil image\n", id.String())
|
||||
composeEntry.ImageSize = 0
|
||||
}
|
||||
|
||||
composeEntry.JobCreated = float64(compose.JobCreated.UnixNano()) / 1000000000
|
||||
composeEntry.JobStarted = float64(compose.JobStarted.UnixNano()) / 1000000000
|
||||
composeEntry.JobFinished = float64(compose.JobFinished.UnixNano()) / 1000000000
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue