compilator

package
v0.0.0-...-3b61a40 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContainerPackagesDir represents the default location of installed BOSH packages
	ContainerPackagesDir = "/var/vcap/packages"
	// ContainerSourceDir is the directory in which the source code will reside when we
	// compile them.  We will add a volume mount there in the container to work around
	// issues with AUFS not emulating a normal filesystem correctly.
	ContainerSourceDir = "/var/vcap/source"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Compilator

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

Compilator represents the BOSH compiler

func NewDockerCompilator

func NewDockerCompilator(
	dockerManager *docker.ImageManager,
	hostWorkDir string,
	metricsPath string,
	stemcellImageName string,
	baseType string,
	fissileVersion string,
	dockerNetworkMode string,
	keepContainer bool,
	ui *termui.UI,
	grapher util.ModelGrapher,
	packageStorage *PackageStorage,
) (*Compilator, error)

NewDockerCompilator will create an instance of the Compilator using docker

func NewMountNSCompilator

func NewMountNSCompilator(
	hostWorkDir string,
	metricsPath string,
	stemcellImageName string,
	baseType string,
	fissileVersion string,
	ui *termui.UI,
	grapher util.ModelGrapher,
	packageStorage *PackageStorage,
) (*Compilator, error)

NewMountNSCompilator will create an instance of the Compilator using a mount namespace (Linux only)

func (*Compilator) Compile

func (c *Compilator) Compile(workerCount int, releases []*model.Release, instanceGroups model.InstanceGroups, verbose bool) error

Compile concurrency works like this: 1 routine producing (todoCh<-) <=> Compile() itself n workers consuming (<-todoCh) <=> compileJob.Run()'s 1 synchronizer consuming EXACTLY 1 <-doneCh for every <-todoCh <=> Compile() again.

Dependencies:

  • Packages with the least dependencies are queued first.
  • Workers wait for their dependencies by waiting on a map of broadcasting channels that are closed by the synchronizer when something is done compiling successfully ==> c.signalDependencies [<fingerprint>]

In the event of an error:

  • workers will try to bail out of waiting on <-todo or <-c.signalDependencies[<fingerprint>] early if it finds the killCh has been activated. There is a "race" here to see if the synchronizer will drain <-todoCh or if they will select on <-killCh before <-todoCh. In the worst case, extra packages will be compiled by each active worker. See (**), (xx)

    Note that jobs without dependencies ignore the kill signal. See (xx).

  • synchronizer will greedily drain the <-todoCh to starve the workers out and won't wait for the <-doneCh for the N packages it drained.

type DownloadProgressEvent

type DownloadProgressEvent = func(progressPercentage float64)

DownloadProgressEvent represents a delegate for updating progress when downloading

type PackageStorage

type PackageStorage struct {
	Kind               string
	Config             stow.Config
	CompilationWorkDir string

	ImageName string
	ReadOnly  bool
	// contains filtered or unexported fields
}

PackageStorage represents a compiled BOSH package location

func NewPackageStorage

func NewPackageStorage(kind string, readOnlyMode bool, config stow.Config, compilationWorkDir string, containerPath string, stemcellImageName string) (p *PackageStorage, err error)

NewPackageStorage creates a new PackageStorage instance

func NewPackageStorageFromConfig

func NewPackageStorageFromConfig(configFilePath, compilationWorkDir, stemcellImageName string) (*PackageStorage, error)

NewPackageStorageFromConfig creates a new PackageStorage based on a configuration file

func (*PackageStorage) Download

func (p *PackageStorage) Download(pack *model.Package, progressEvent DownloadProgressEvent) error

Download downloads a package from the configured cache

func (*PackageStorage) Exists

func (p *PackageStorage) Exists(pack *model.Package) (bool, error)

Exists checks whether a package already exists in the configured stow cache

func (*PackageStorage) Upload

func (p *PackageStorage) Upload(pack *model.Package) error

Upload uploads a package to the configured cache

Jump to

Keyboard shortcuts

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