service

package
v0.1.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Overview

nolint: dupl,golint

nolint: dupl,golint

nolint: dupl,golint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRIO

type CRIO struct{}

CRIO implements the Service interface. It serves as the concrete type with the required methods.

func (*CRIO) Cmd

func (p *CRIO) Cmd(data userdata.UserData, cmdArgs *CmdArgs) error

Cmd implements the Service interface.

func (*CRIO) Condition

func (p *CRIO) Condition(data userdata.UserData) func() (bool, error)

Condition implements the Service interface.

func (*CRIO) Env

func (p *CRIO) Env() []string

Env implements the Service interface.

func (*CRIO) Post

func (p *CRIO) Post(data userdata.UserData) (err error)

Post implements the Service interface.

func (*CRIO) Pre

func (p *CRIO) Pre(data userdata.UserData) error

Pre implements the Service interface.

func (*CRIO) Type

func (p *CRIO) Type() Type

Type implements the Service interface.

type CmdArgs

type CmdArgs struct {
	Path string
	Name string
	Args []string
}

CmdArgs represent the options available to services specific to the configuration of their cmd.

type Docker

type Docker struct{}

Docker implements the Service interface. It serves as the concrete type with the required methods.

func (*Docker) Cmd

func (p *Docker) Cmd(data userdata.UserData, cmdArgs *CmdArgs) error

Cmd implements the Service interface.

func (*Docker) Condition

func (p *Docker) Condition(data userdata.UserData) func() (bool, error)

Condition implements the Service interface.

func (*Docker) Env

func (p *Docker) Env() []string

Env implements the Service interface.

func (*Docker) Post

func (p *Docker) Post(data userdata.UserData) (err error)

Post implements the Service interface.

func (*Docker) Pre

func (p *Docker) Pre(data userdata.UserData) error

Pre implements the Service interface.

func (*Docker) Type

func (p *Docker) Type() Type

Type implements the Service interface.

type Kubeadm

type Kubeadm struct{}

Kubeadm implements the Service interface. It serves as the concrete type with the required methods.

func (*Kubeadm) Cmd

func (p *Kubeadm) Cmd(data userdata.UserData, cmdArgs *CmdArgs) error

Cmd implements the Service interface.

func (*Kubeadm) Condition

func (p *Kubeadm) Condition(data userdata.UserData) func() (bool, error)

Condition implements the Service interface.

func (*Kubeadm) Env

func (p *Kubeadm) Env() []string

Env implements the Service interface.

func (*Kubeadm) Post

func (p *Kubeadm) Post(data userdata.UserData) (err error)

Post implements the Service interface.

func (*Kubeadm) Pre

func (p *Kubeadm) Pre(data userdata.UserData) (err error)

Pre implements the Service interface.

func (*Kubeadm) Type

func (p *Kubeadm) Type() Type

Type implements the Service interface.

type Kubelet

type Kubelet struct{}

Kubelet implements the Service interface. It serves as the concrete type with the required methods.

func (*Kubelet) Cmd

func (p *Kubelet) Cmd(data userdata.UserData, cmdArgs *CmdArgs) error

Cmd implements the Service interface.

func (*Kubelet) Condition

func (p *Kubelet) Condition(data userdata.UserData) func() (bool, error)

Condition implements the Service interface.

func (*Kubelet) Env

func (p *Kubelet) Env() []string

Env implements the Service interface.

func (*Kubelet) Post

func (p *Kubelet) Post(data userdata.UserData) (err error)

Post implements the Service interface.

func (*Kubelet) Pre

func (p *Kubelet) Pre(data userdata.UserData) error

Pre implements the Service interface.

func (*Kubelet) Type

func (p *Kubelet) Type() Type

Type implements the Service interface.

type Manager

type Manager struct {
	UserData userdata.UserData
}

Manager is a type with helper methods that build a service and invoke the set of methods defined in the Service interface.

func (*Manager) Start

func (m *Manager) Start(proc Service)

Start will invoke the service's Pre, Condition, and Type funcs. If the any error occurs in the Pre or Condition invocations, it is up to the caller to to restart the service.

type OSD

type OSD struct{}

OSD implements the Service interface. It serves as the concrete type with the required methods.

func (*OSD) Cmd

func (p *OSD) Cmd(data userdata.UserData, cmdArgs *CmdArgs) error

Cmd implements the Service interface.

func (*OSD) Condition

func (p *OSD) Condition(data userdata.UserData) func() (bool, error)

Condition implements the Service interface.

func (*OSD) Env

func (p *OSD) Env() []string

Env implements the Service interface.

func (*OSD) Post

func (p *OSD) Post(data userdata.UserData) (err error)

Post implements the Service interface.

func (*OSD) Pre

func (p *OSD) Pre(data userdata.UserData) error

Pre implements the Service interface.

func (*OSD) Type

func (p *OSD) Type() Type

Type implements the Service interface.

type ProxyD

type ProxyD struct{}

ProxyD implements the Service interface. It serves as the concrete type with the required methods.

func (*ProxyD) Cmd

func (p *ProxyD) Cmd(data userdata.UserData, cmdArgs *CmdArgs) error

Cmd implements the Service interface.

func (*ProxyD) Condition

func (p *ProxyD) Condition(data userdata.UserData) func() (bool, error)

Condition implements the Service interface.

func (*ProxyD) Env

func (p *ProxyD) Env() []string

Env implements the Service interface.

func (*ProxyD) Post

func (p *ProxyD) Post(data userdata.UserData) (err error)

Post implements the Service interface.

func (*ProxyD) Pre

func (p *ProxyD) Pre(data userdata.UserData) error

Pre implements the Service interface.

func (*ProxyD) Type

func (p *ProxyD) Type() Type

Type implements the Service interface.

type ROTD

type ROTD struct{}

ROTD implements the Service interface. It serves as the concrete type with the required methods.

func (*ROTD) Cmd

func (p *ROTD) Cmd(data userdata.UserData, cmdArgs *CmdArgs) error

Cmd implements the Service interface.

func (*ROTD) Condition

func (p *ROTD) Condition(data userdata.UserData) func() (bool, error)

Condition implements the Service interface.

func (*ROTD) Env

func (p *ROTD) Env() []string

Env implements the Service interface.

func (*ROTD) Post

func (p *ROTD) Post(data userdata.UserData) (err error)

Post implements the Service interface.

func (*ROTD) Pre

func (p *ROTD) Pre(data userdata.UserData) error

Pre implements the Service interface.

func (*ROTD) Type

func (p *ROTD) Type() Type

Type implements the Service interface.

type Service

type Service interface {
	// Pre is invoked before a command is executed. It is useful for things like
	// preparing files that the process might depend on.
	Pre(userdata.UserData) error
	// Post is invoked after a command is executed.
	Post(userdata.UserData) error
	// Cmd describes the path to the binary, and the set of arguments to be
	// passed into it upon execution.
	Cmd(userdata.UserData, *CmdArgs) error
	// Condition is invoked just before starting the process.
	Condition(userdata.UserData) func() (bool, error)
	// Env describes the service's environment variables. Elements should be in
	// the format <key=<value>
	Env() []string
	// Type describes the service's restart policy.
	Type() Type
}

Service is an interface describing a process that is to be run as a system level service.

type Type

type Type int

Type represents the service's restart policy.

const (
	// Forever will always restart a process.
	Forever Type = iota
	// Once will restart the process only if it did not exit successfully.
	Once
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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