jobqueue: move Job struct to client.go
`Job` is now a simple data struct, which is only used to return multiple arguments from `AddJob()`. Move it to that file.
This commit is contained in:
parent
1ece08414c
commit
ada058f2c3
2 changed files with 17 additions and 20 deletions
|
|
@ -12,7 +12,11 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"github.com/osbuild/osbuild-composer/internal/common"
|
"github.com/osbuild/osbuild-composer/internal/common"
|
||||||
|
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||||
|
"github.com/osbuild/osbuild-composer/internal/target"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
|
|
@ -21,6 +25,13 @@ type Client struct {
|
||||||
hostname string
|
hostname string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Job struct {
|
||||||
|
ComposeID uuid.UUID
|
||||||
|
ImageBuildID int
|
||||||
|
Manifest *osbuild.Manifest
|
||||||
|
Targets []*target.Target
|
||||||
|
}
|
||||||
|
|
||||||
func NewClient(address string, conf *tls.Config) *Client {
|
func NewClient(address string, conf *tls.Config) *Client {
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
|
|
@ -77,7 +88,12 @@ func (c *Client) AddJob() (*Job, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewJob(jr.ComposeID, jr.ImageBuildID, jr.Manifest, jr.Targets), nil
|
return &Job{
|
||||||
|
jr.ComposeID,
|
||||||
|
jr.ImageBuildID,
|
||||||
|
jr.Manifest,
|
||||||
|
jr.Targets,
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UpdateJob(job *Job, status common.ImageBuildState, result *common.ComposeResult) error {
|
func (c *Client) UpdateJob(job *Job, status common.ImageBuildState, result *common.ComposeResult) error {
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
package jobqueue
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/google/uuid"
|
|
||||||
|
|
||||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
|
||||||
"github.com/osbuild/osbuild-composer/internal/target"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Job struct {
|
|
||||||
ComposeID uuid.UUID
|
|
||||||
ImageBuildID int
|
|
||||||
Manifest *osbuild.Manifest
|
|
||||||
Targets []*target.Target
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewJob(id uuid.UUID, imageBuildID int, manifest *osbuild.Manifest, targets []*target.Target) *Job {
|
|
||||||
return &Job{id, imageBuildID, manifest, targets}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue