orchestrator

package
v0.0.0-...-6ef79a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const ErrMsgLaunchCVDFailed = "failed to launch cvd"
View Source
const HeaderBuildAPICreds = "X-Cutf-Host-Orchestrator-BuildAPI-Creds"

Variables

This section is empty.

Functions

func CVDLogsDir

func CVDLogsDir(ctx cvd.CVDExecContext, name string) (string, error)

func HostBugReport

func HostBugReport(ctx cvd.CVDExecContext, paths IMPaths, out string) error

func SliceItoa

func SliceItoa(s []uint32) []string

func Untar

func Untar(dst string, src string) error

func Unzip

func Unzip(dstDir string, src string) error

Types

type AndroidBuild

type AndroidBuild struct {
	ID     string
	Target string
}

type CVDSelector

type CVDSelector struct {
	Group string
	Name  string
}

func (*CVDSelector) ToCVDCLI

func (s *CVDSelector) ToCVDCLI() []string

type Config

type Config struct {
	Paths                  IMPaths
	AndroidBuildServiceURL string
	CVDCreationTimeout     time.Duration
	CVDUser                string
}

type Controller

type Controller struct {
	Config                Config
	OperationManager      OperationManager
	WaitOperationDuration time.Duration
	UserArtifactsManager  UserArtifactsManager
	DebugVariablesManager *debug.VariablesManager
}

func (*Controller) AddRoutes

func (c *Controller) AddRoutes(router *mux.Router)

type CreateCVDAction

type CreateCVDAction struct {
	// contains filtered or unexported fields
}

func NewCreateCVDAction

func NewCreateCVDAction(opts CreateCVDActionOpts) *CreateCVDAction

func (*CreateCVDAction) Run

func (a *CreateCVDAction) Run() (apiv1.Operation, error)

type CreateCVDActionOpts

type CreateCVDActionOpts struct {
	Request                  *apiv1.CreateCVDRequest
	HostValidator            Validator
	Paths                    IMPaths
	OperationManager         OperationManager
	ExecContext              ExecContext
	BuildAPI                 artifacts.BuildAPI
	ArtifactsFetcher         artifacts.Fetcher
	CVDBundleFetcher         artifacts.CVDBundleFetcher
	UUIDGen                  func() string
	CVDUser                  string
	CVDStartTimeout          time.Duration
	UserArtifactsDirResolver UserArtifactsDirResolver
	BuildAPICredentials      string
}

type EmptyFieldError

type EmptyFieldError string

func (EmptyFieldError) Error

func (s EmptyFieldError) Error() string

type ExecCVDCommandAction

type ExecCVDCommandAction struct {
	// contains filtered or unexported fields
}

func NewExecCVDCommandAction

func NewExecCVDCommandAction(opts ExecCVDCommandActionOpts) *ExecCVDCommandAction

func (*ExecCVDCommandAction) Run

type ExecCVDCommandActionOpts

type ExecCVDCommandActionOpts struct {
	Command          string
	Selector         CVDSelector
	Paths            IMPaths
	OperationManager OperationManager
	ExecContext      ExecContext
	CVDUser          string
}

type ExecContext

type ExecContext = func(ctx context.Context, name string, arg ...string) *exec.Cmd

type FetchArtifactsAction

type FetchArtifactsAction struct {
	// contains filtered or unexported fields
}

func NewFetchArtifactsAction

func NewFetchArtifactsAction(opts FetchArtifactsActionOpts) *FetchArtifactsAction

func (*FetchArtifactsAction) Run

type FetchArtifactsActionOpts

type FetchArtifactsActionOpts struct {
	Request          *apiv1.FetchArtifactsRequest
	Paths            IMPaths
	OperationManager OperationManager
	BuildAPI         artifacts.BuildAPI
	CVDBundleFetcher artifacts.CVDBundleFetcher
	ArtifactsFetcher artifacts.Fetcher
	UUIDGen          func() string
}

type HostValidator

type HostValidator struct {
	ExecContext ExecContext
}

Validates whether the current host is valid to run CVDs.

func (*HostValidator) Validate

func (v *HostValidator) Validate() error

type IMPaths

type IMPaths struct {
	RootDir          string
	ArtifactsRootDir string
}

type ListCVDsAction

type ListCVDsAction struct {
	// contains filtered or unexported fields
}

func NewListCVDsAction

func NewListCVDsAction(opts ListCVDsActionOpts) *ListCVDsAction

func (*ListCVDsAction) Run

type ListCVDsActionOpts

type ListCVDsActionOpts struct {
	Paths       IMPaths
	ExecContext ExecContext
	CVDUser     string
}

type MapOM

type MapOM struct {
	// contains filtered or unexported fields
}

func NewMapOM

func NewMapOM() *MapOM

func (*MapOM) Complete

func (m *MapOM) Complete(name string, result *OperationResult) error

func (*MapOM) Get

func (m *MapOM) Get(name string) (apiv1.Operation, error)

func (*MapOM) GetResult

func (m *MapOM) GetResult(name string) (*OperationResult, error)

func (*MapOM) New

func (m *MapOM) New() apiv1.Operation

func (*MapOM) Wait

func (m *MapOM) Wait(name string, dt time.Duration) (*OperationResult, error)

type NotFoundOperationError

type NotFoundOperationError string

func (NotFoundOperationError) Error

func (s NotFoundOperationError) Error() string

type OperationManager

type OperationManager interface {
	New() apiv1.Operation

	Get(name string) (apiv1.Operation, error)

	GetResult(name string) (*OperationResult, error)

	Complete(name string, result *OperationResult) error

	// Waits for the specified operation to be DONE within the passed deadline. If the deadline
	// is reached `OperationWaitTimeoutError` will be returned.
	// NOTE: if dt is zero there's no timeout.
	Wait(name string, dt time.Duration) (*OperationResult, error)
}

type OperationNotDoneError

type OperationNotDoneError string

func (OperationNotDoneError) Error

func (s OperationNotDoneError) Error() string

type OperationResult

type OperationResult struct {
	Error error
	Value interface{}
}

type OperationWaitTimeoutError

type OperationWaitTimeoutError struct{}

func (OperationWaitTimeoutError) Error

type UserArtifactChunk

type UserArtifactChunk struct {
	Name           string
	ChunkNumber    int
	ChunkTotal     int
	ChunkSizeBytes int64
	File           io.Reader
}

type UserArtifactsDirResolver

type UserArtifactsDirResolver interface {
	// Given a directory name returns its full path.
	GetDirPath(name string) string
}

Resolves the user artifacts full directory.

type UserArtifactsManager

type UserArtifactsManager interface {
	UserArtifactsDirResolver
	// Creates a new directory for uploading user artifacts in the future.
	NewDir() (*apiv1.UploadDirectory, error)
	// List existing directories
	ListDirs() (*apiv1.ListUploadDirectoriesResponse, error)
	// Update artifact with the passed chunk.
	UpdateArtifact(dir string, chunk UserArtifactChunk) error
	// Extract artifact
	ExtractArtifact(dir, name string) error
}

Abstraction for managing user artifacts for launching CVDs.

type UserArtifactsManagerImpl

type UserArtifactsManagerImpl struct {
	UserArtifactsManagerOpts
}

An implementation of the UserArtifactsManager interface.

func NewUserArtifactsManagerImpl

func NewUserArtifactsManagerImpl(opts UserArtifactsManagerOpts) *UserArtifactsManagerImpl

Creates a new instance of UserArtifactsManagerImpl.

func (*UserArtifactsManagerImpl) ExtractArtifact

func (m *UserArtifactsManagerImpl) ExtractArtifact(dir, name string) error

func (*UserArtifactsManagerImpl) GetDirPath

func (m *UserArtifactsManagerImpl) GetDirPath(name string) string

func (*UserArtifactsManagerImpl) GetFilePath

func (m *UserArtifactsManagerImpl) GetFilePath(dir, filename string) string

func (*UserArtifactsManagerImpl) ListDirs

func (*UserArtifactsManagerImpl) NewDir

func (*UserArtifactsManagerImpl) UpdateArtifact

func (m *UserArtifactsManagerImpl) UpdateArtifact(dir string, chunk UserArtifactChunk) error

type UserArtifactsManagerOpts

type UserArtifactsManagerOpts struct {
	// The root directory where to store the artifacts.
	RootDir string
	// Factory of name values
	NameFactory func() string
}

Options for creating instances of UserArtifactsManager implementations.

type Validator

type Validator interface {
	Validate() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL