compilator

package
v0.0.0-...-db657e9 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2017 License: Apache-2.0 Imports: 22 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,
	keepContainer bool,
	ui *termui.UI,
) (*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,
) (*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, roles model.Roles) 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.

Jump to

Keyboard shortcuts

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