2020-03-29 16:03:07 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2023-10-03 17:25:41 +00:00
|
|
|
"gitlab.com/manytask/itmo-go/public/distbuild/pkg/build"
|
2020-03-29 16:03:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type BuildRequest struct {
|
|
|
|
Graph build.Graph
|
|
|
|
}
|
|
|
|
|
|
|
|
type BuildStarted struct {
|
|
|
|
ID build.ID
|
|
|
|
MissingFiles []build.ID
|
|
|
|
}
|
|
|
|
|
|
|
|
type StatusUpdate struct {
|
|
|
|
JobFinished *JobResult
|
|
|
|
BuildFailed *BuildFailed
|
|
|
|
BuildFinished *BuildFinished
|
|
|
|
}
|
|
|
|
|
|
|
|
type BuildFailed struct {
|
|
|
|
Error string
|
|
|
|
}
|
|
|
|
|
2023-10-02 19:32:41 +00:00
|
|
|
type BuildFinished struct{}
|
2020-03-29 16:03:07 +00:00
|
|
|
|
2020-04-04 20:11:21 +00:00
|
|
|
type UploadDone struct{}
|
|
|
|
|
2020-03-29 16:03:07 +00:00
|
|
|
type SignalRequest struct {
|
2020-04-04 20:11:21 +00:00
|
|
|
UploadDone *UploadDone
|
2020-03-29 16:03:07 +00:00
|
|
|
}
|
|
|
|
|
2023-10-02 19:32:41 +00:00
|
|
|
type SignalResponse struct{}
|
2020-03-29 16:03:07 +00:00
|
|
|
|
|
|
|
type StatusWriter interface {
|
|
|
|
Started(rsp *BuildStarted) error
|
|
|
|
Updated(update *StatusUpdate) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type Service interface {
|
|
|
|
StartBuild(ctx context.Context, request *BuildRequest, w StatusWriter) error
|
|
|
|
SignalBuild(ctx context.Context, buildID build.ID, signal *SignalRequest) (*SignalResponse, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type StatusReader interface {
|
|
|
|
Close() error
|
|
|
|
Next() (*StatusUpdate, error)
|
|
|
|
}
|