bosh

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRoot = "/var/vcap"

DefaultRoot is the standard root directory for all bosh jobs. All ephemeral data, persistent data, logs, and configuration etc. are expected to be in a directory somewhere inside this one.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

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

Env represents a BOSH BPM environment. This is not a concept outside BPM but allows us to isolate BPM invocations from one another so that integration tests can be made concurrent.

func NewEnv

func NewEnv(root string) *Env

NewEnv creates a new environment with a particular directory as its root. If root is empty then the DefaultRoot will be used.

func (*Env) DataDir

func (e *Env) DataDir(job string) Path

DataDir returns a Path representation of the directory where a job should store its ephemeral data.

func (*Env) DataPackageDir

func (e *Env) DataPackageDir() Path

DataPackageDir returns a Path representation of the global directory where all BOSH packages are actually stored (PackageDir is typically a symlink to this).

func (*Env) JobDir

func (e *Env) JobDir(job string) Path

JobDir returns a Path representation of the directory where a job should can find its templated BOSH configuration.

func (*Env) JobNames

func (e *Env) JobNames() []string

JobNames returns a list of all the job names inside a BOSH environment.

func (*Env) LogDir

func (e *Env) LogDir(job string) Path

LogDir returns a Path representation of the directory where a job should write any additional log files.

func (*Env) PackageDir

func (e *Env) PackageDir() Path

PackageDir returns a Path representation of the global directory where all BOSH packages are stored.

func (*Env) Root

func (e *Env) Root() Path

Root returns a Path representation of the environment's root. It is typically not useful by itself but can be appended to with Path.Join().

func (*Env) RunDir

func (e *Env) RunDir(job string) Path

RunDir returns a Path representation of the directory where a job should store any sockets or PID files.

func (*Env) StoreDir

func (e *Env) StoreDir(job string) Path

StoreDir returns a Path representation of the directory where a job should store its persistent data.

type Path

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

Path represents a filesystem path to some kind of directory inside a BOSH root. A Path has an internal and external representation. The external representation is the path outside the running BPM job. The internal representation is the path when inside the BPM job mount namespace. In production these will always be the DefaultRoot.

This abstraction only exists because we want to have multiple roots on a single machine so we can run integration tests concurrently. Forcing the consumer to chose between the Internal() or External() representation removes a category of bugs around external test harness paths being present in the test jobs.

func (Path) External

func (p Path) External() string

Internal returns the external representation of the Path.

func (Path) Internal

func (p Path) Internal() string

Internal returns the internal representation of the Path.

func (Path) Join

func (p Path) Join(elements ...string) Path

Join allows one or more elements to be joined onto a Path (similar to filepath.Join). It returns a new Path with the new elements appended.

func (Path) String

func (p Path) String() string

String implements the Stringer interface but should never be used. This was added to avoid the common mistake of doing:

fmt.{S,F,}Printf("... %s ...", bosh.Path{...})

Which will does not make it clear if the internal or external representation is wanted and is likely a bug. Omitting this function returns the standard Go representation of the struct which is almost certainly wrong.

Jump to

Keyboard shortcuts

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