hoist

package
v0.0.0-...-8223eb1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IncludePodIDArg = param.Bool("include_pod_id_arg", false)

IncludePodIDArg will include a --podID argument to p2-exec. Delaying the use of this argument from the rollout of the binary that understands it allows for n-1 version compatibility

Functions

func CleanupFakeLaunchable

func CleanupFakeLaunchable(h *Launchable, s *runit.ServiceBuilder)

func IsMissingEntryPoints

func IsMissingEntryPoints(err error) bool

Types

type EntryPoints

type EntryPoints struct {
	// Paths contains the relative paths to each entry point from the root
	// of the launchable
	Paths []string
	// Implicit means that the entry points were not explicitly specified
	// in the pod manifest and instead a default was used. This is useful
	// information since we want to treat a missing entry point as an error
	// if and only if it was listed explicitly
	Implicit bool
}

type LaunchAdapter

type LaunchAdapter struct {
	*Launchable
}

LaunchAdapter adapts a hoist.Launchable to the launch.Launchable interface.

func (LaunchAdapter) ID

func (LaunchAdapter) ServiceID

func (a LaunchAdapter) ServiceID() string

type Launchable

type Launchable struct {
	Id               launch.LaunchableID        // A (pod-wise) unique identifier for this launchable, used to distinguish it from other launchables in the pod
	Version          launch.LaunchableVersionID // A version identifier
	PodID            types.PodID                // A (possibly-null) PodID denoting which launchable this belongs to
	ServiceId        string                     // A (host-wise) unique identifier for this launchable, used when creating runit services
	RunAs            string                     // The user to assume when launching the executable
	OwnAs            string                     // The user that owns all the launcable's artifacts
	PodEnvDir        string                     // The value for chpst -e. See http://smarden.org/runit/chpst.8.html
	RootDir          string                     // The root directory of the launchable, containing N:N>=1 installs.
	P2Exec           string                     // Struct that can be used to build a p2-exec invocation with appropriate flags
	ExecNoLimit      bool                       // If set, execute with the -n (--no-limit) argument to p2-exec
	PodCgroupConfig  cgroups.Config             // PodCgroupConfig
	CgroupConfig     cgroups.Config             // Cgroup parameters to use with p2-exec
	CgroupConfigName string                     // The string in PLATFORM_CONFIG to pass to p2-exec
	CgroupName       string                     // The name of the cgroup to run this launchable in
	RequireFile      string                     // Do not run this launchable until this file exists
	RestartTimeout   time.Duration              // How long to wait when restarting the services in this launchable.
	RestartPolicy_   runit.RestartPolicy        // Dictates whether the launchable should be automatically restarted upon exit.
	NoHaltOnUpdate_  bool                       // If set, the launchable's process(es) should not be stopped if the pod is being updated (it will arrange for its own signaling)
	SuppliedEnvVars  map[string]string          // A map of user-supplied environment variables to be exported for this launchable
	Location         *url.URL                   // URL to download the artifact from
	VerificationData auth.VerificationData      // Paths to files used to verify the artifact
	EntryPoints      EntryPoints                // paths to entry points to launch under runit

	// IsUUIDPod indicates whether the launchable is part of a "uuid pod"
	// vs a "legacy pod". Currently this information is used for determining the name of the runit service directories to use
	// for each of a pod's processes. UUID pods use the "new" naming scheme and legacy pods use the "old" naming scheme.
	//
	// Example old naming scheme:
	// /var/service/some-pod__some-launchable__launch/
	//
	// Example new naming scheme (includes full relative path to entry point with
	// slashes exchanged for double underscores):
	// /var/service/some-pod-<uuid>__some-launchable__bin__launch/
	IsUUIDPod bool
}

A HoistLaunchable represents a particular install of a hoist artifact.

func FakeHoistLaunchableForDirLegacyPod

func FakeHoistLaunchableForDirLegacyPod(dirName string) (*Launchable, *runit.ServiceBuilder)

func FakeHoistLaunchableForDirUUIDPod

func FakeHoistLaunchableForDirUUIDPod(dirName string) (*Launchable, *runit.ServiceBuilder)

func (*Launchable) AllInstallsDir

func (hl *Launchable) AllInstallsDir() string

func (*Launchable) AppManifest

func (hl *Launchable) AppManifest() (*artifact.AppManifest, error)

func (*Launchable) CurrentDir

func (hl *Launchable) CurrentDir() string

func (*Launchable) Disable

func (hl *Launchable) Disable(gracePeriod time.Duration) error

func (*Launchable) EnvDir

func (hl *Launchable) EnvDir() string

func (*Launchable) EnvVars

func (hl *Launchable) EnvVars() map[string]string

func (*Launchable) Executables

func (hl *Launchable) Executables(
	serviceBuilder *runit.ServiceBuilder,
) ([]launch.Executable, error)

Executables() returns a list of the executables present in the launchable. The podUniqueKey argument is a bit of a hack: If it is empty then the "old" naming scheme for runit service directories will be used. Otherwise the newer naming scheme will be used.

Example old naming scheme: /var/service/some-pod__some-launchable__launch/

Example new naming scheme (includes full relative path to entry point with slashes exchanged for double underscores): /var/service/some-pod-<uuid>__some-launchable__bin__launch/

func (*Launchable) GetOwnAs

func (hl *Launchable) GetOwnAs() string

func (*Launchable) GetRestartTimeout

func (hl *Launchable) GetRestartTimeout() time.Duration

func (*Launchable) If

func (hl *Launchable) If() launch.Launchable

If adapts the hoist Launchable to the launch.Launchable interface.

func (*Launchable) InstallDir

func (hl *Launchable) InstallDir() string

func (*Launchable) Installed

func (hl *Launchable) Installed() bool

func (*Launchable) InvokeBinScript

func (hl *Launchable) InvokeBinScript(script string) (string, error)

func (*Launchable) InvokeBinScriptWithContext

func (hl *Launchable) InvokeBinScriptWithContext(ctx context.Context, script string) (string, error)

func (*Launchable) IsOneoff

func (hl *Launchable) IsOneoff() bool

func (*Launchable) LastDir

func (hl *Launchable) LastDir() string

func (*Launchable) Launch

func (hl *Launchable) Launch(serviceBuilder *runit.ServiceBuilder, sv runit.SV) error

func (*Launchable) MakeCurrent

func (hl *Launchable) MakeCurrent() error

func (*Launchable) Name

func (hl *Launchable) Name() string

The version of the artifact is determined from the artifact location. If the version tag is set in the location's query, that is returned. Otherwise, the version is derived from the location, using the naming scheme <the-app>_<unique-version-string>.tar.gz

func (*Launchable) PostActivate

func (hl *Launchable) PostActivate() (string, error)

func (*Launchable) PostInstall

func (hl *Launchable) PostInstall() (string, error)

func (*Launchable) Prune

func (hl *Launchable) Prune(maxSize size.ByteCount) error

Prune will attempt to get the total size of the launchable's installs directory to be equal to or less than the maximum specified number of bytes. This method will preserve any directories that are pointed to by the `current` or `last` symlinks. Installations will be removed from oldest to newest.

func (*Launchable) RestartPolicy

func (hl *Launchable) RestartPolicy() runit.RestartPolicy

func (*Launchable) Stop

func (hl *Launchable) Stop(serviceBuilder *runit.ServiceBuilder, sv runit.SV, force bool) error

func (*Launchable) Type

func (*Launchable) Type() string

type MissingEntryPoints

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

func (MissingEntryPoints) Error

func (m MissingEntryPoints) Error() string

Jump to

Keyboard shortcuts

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