linux_backend

package
v0.333.2-candidate Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2016 License: Apache-2.0 Imports: 19 Imported by: 67

Documentation

Index

Constants

View Source
const (
	StateBorn    = State("born")
	StateActive  = State("active")
	StateStopped = State("stopped")
)

Variables

This section is empty.

Functions

func RegisterHooks

func RegisterHooks(hs hook.HookSet, runner Runner, config process.Env, configurer network.Configurer)

Types

type ActiveProcess

type ActiveProcess struct {
	ID  uint32
	TTY bool
}

type Config

type Config struct {
	Network json.RawMessage `json:"network"`
}

type Container

type Container interface {
	ID() string
	HasProperties(garden.Properties) bool
	GraceTime() time.Duration

	Start() error

	Snapshot(io.Writer) error
	ResourceSpec() LinuxContainerSpec
	Restore(LinuxContainerSpec) error
	Cleanup() error

	LimitDisk(limits garden.DiskLimits) error

	garden.Container
}

type ContainerProvider

type ContainerProvider interface {
	ProvideContainer(LinuxContainerSpec) Container
}

type ContainerRepository

type ContainerRepository interface {
	All() []Container
	Add(Container)
	FindByHandle(string) (Container, error)
	Query(filter func(Container) bool, logger lager.Logger) []Container
	Delete(Container)
}

type FailedToSnapshotError

type FailedToSnapshotError struct {
	OriginalError error
}

func (FailedToSnapshotError) Error

func (e FailedToSnapshotError) Error() string

type HandleExistsError

type HandleExistsError struct {
	Handle string
}

func (HandleExistsError) Error

func (e HandleExistsError) Error() string

type HealthChecker

type HealthChecker interface {
	HealthCheck() error
}

type Limits

type Limits struct {
	Memory    *garden.MemoryLimits
	Disk      *garden.DiskLimits
	Bandwidth *garden.BandwidthLimits
	CPU       *garden.CPULimits
}

type LinuxBackend

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

func New

func New(
	logger lager.Logger,
	resourcePool ResourcePool,
	containerRepo ContainerRepository,
	containerProvider ContainerProvider,
	systemInfo sysinfo.Provider,
	healthCheck HealthChecker,
	snapshotsPath string,
	maxContainers int,
) *LinuxBackend

func (*LinuxBackend) ApplyLimits

func (b *LinuxBackend) ApplyLimits(container Container, limits garden.Limits) error

func (*LinuxBackend) BulkInfo

func (b *LinuxBackend) BulkInfo(handles []string) (map[string]garden.ContainerInfoEntry, error)

func (*LinuxBackend) BulkMetrics

func (b *LinuxBackend) BulkMetrics(handles []string) (map[string]garden.ContainerMetricsEntry, error)

func (*LinuxBackend) Capacity

func (b *LinuxBackend) Capacity() (garden.Capacity, error)

func (*LinuxBackend) Containers

func (b *LinuxBackend) Containers(props garden.Properties) ([]garden.Container, error)

func (*LinuxBackend) Create

func (*LinuxBackend) Destroy

func (b *LinuxBackend) Destroy(handle string) error

func (*LinuxBackend) GraceTime

func (b *LinuxBackend) GraceTime(container garden.Container) time.Duration

func (*LinuxBackend) Lookup

func (b *LinuxBackend) Lookup(handle string) (garden.Container, error)

func (*LinuxBackend) Ping

func (b *LinuxBackend) Ping() error

func (*LinuxBackend) Setup

func (b *LinuxBackend) Setup() error

func (*LinuxBackend) Start

func (b *LinuxBackend) Start() error

func (*LinuxBackend) Stop

func (b *LinuxBackend) Stop()

type LinuxContainerSpec

type LinuxContainerSpec struct {
	ID                  string
	ContainerPath       string
	ContainerRootFSPath string

	Resources *Resources
	State     State
	Events    []string

	garden.ContainerSpec

	Limits                  Limits
	Processes               []ActiveProcess
	DefaultProcessSignaller bool

	NetIns  []NetInSpec
	NetOuts []garden.NetOutRule

	Version semver.Version
}

type MaxContainersReachedError

type MaxContainersReachedError struct {
	MaxContainers int
}

func (MaxContainersReachedError) Error

type NetInSpec

type NetInSpec struct {
	HostPort      uint32
	ContainerPort uint32
}

type Network

type Network struct {
	Subnet *net.IPNet
	IP     net.IP
}

func (*Network) MarshalJSON

func (n *Network) MarshalJSON() ([]byte, error)

func (*Network) UnmarshalJSON

func (n *Network) UnmarshalJSON(b []byte) error

type ResourcePool

type ResourcePool interface {
	Setup() error
	Acquire(garden.ContainerSpec) (LinuxContainerSpec, error)
	Restore(io.Reader) (LinuxContainerSpec, error)
	Release(LinuxContainerSpec) error
	Prune(keep map[string]bool) error
	MaxContainers() int
}

type Resources

type Resources struct {
	RootUID    int
	Network    *Network
	Bridge     string
	Ports      []uint32
	ExternalIP net.IP
	// contains filtered or unexported fields
}

func NewResources

func NewResources(
	rootuid int,
	network *Network,
	bridge string,
	ports []uint32,
	externalIP net.IP,
) *Resources

func (*Resources) AddPort

func (r *Resources) AddPort(port uint32)

type RootFSCleaner

type RootFSCleaner struct {
	FilePaths []string
}

func (*RootFSCleaner) Clean

func (r *RootFSCleaner) Clean(log lager.Logger, path string) error

type Runner

type Runner interface {
	Run(*exec.Cmd) error
}

type State

type State string

Directories

Path Synopsis
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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