core

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2017 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const MaxListeners = 500

Variables

View Source
var (
	ErrApplicationAlreadyExists = errors.New("Application already exists")
	ErrApplicationNotFound      = errors.New("Application not found")
	ErrGoalNotFound             = errors.New("Goal not found")
)

Functions

func ContainsString

func ContainsString(slice []string, val string) bool

func ParseRepositoryTag

func ParseRepositoryTag(repos string) (string, string)

Types

type Apparatchik

type Apparatchik struct {
	sync.Mutex

	*emission.Emitter
	// contains filtered or unexported fields
}
var ApparatchikInstance *Apparatchik

func StartApparatchik

func StartApparatchik(dockerClient *client.Client) (*Apparatchik, error)

func (*Apparatchik) ApplicatioNames

func (a *Apparatchik) ApplicatioNames() []string

func (*Apparatchik) ApplicationByName

func (a *Apparatchik) ApplicationByName(name string) (*Application, error)

func (*Apparatchik) ApplicationStatus

func (p *Apparatchik) ApplicationStatus(applicatioName string) (ApplicationStatus, error)

func (*Apparatchik) GetApplicationByName

func (a *Apparatchik) GetApplicationByName(name string) (*Application, error)

func (*Apparatchik) GetContainerIDForGoal

func (a *Apparatchik) GetContainerIDForGoal(applicatioName, goalName string) (*string, error)

func (*Apparatchik) HandleDockerEvent

func (a *Apparatchik) HandleDockerEvent(evt events.Message)

func (*Apparatchik) NewApplication

func (a *Apparatchik) NewApplication(name string, config *ApplicationConfiguration) (ApplicationStatus, error)

func (*Apparatchik) Stop

func (a *Apparatchik) Stop()

func (*Apparatchik) TerminateApplication

func (a *Apparatchik) TerminateApplication(applicationName string) error

type Application

type Application struct {
	sync.Mutex
	Name                string
	Configuration       *ApplicationConfiguration
	Goals               map[string]*Goal
	MainGoal            string
	ApplicationFileName string
	DockerClient        *client.Client
	*emission.Emitter
}

func NewApplication

func NewApplication(applicationName string, applicationConfiguration *ApplicationConfiguration, dockerClient *client.Client) *Application

func NewApplicationWithDockerClientFromEnv

func NewApplicationWithDockerClientFromEnv(applicationName string, applicationConfiguration *ApplicationConfiguration) (*Application, error)

func (*Application) GoalStatusUpdate

func (a *Application) GoalStatusUpdate(goalName, status string)

func (*Application) HandleDockerEvent

func (a *Application) HandleDockerEvent(evt events.Message)

func (*Application) Inspect

func (a *Application) Inspect(goalName string) (types.ContainerJSON, error)

func (*Application) RequestGoalStart

func (a *Application) RequestGoalStart(name string)

func (*Application) Status

func (a *Application) Status() ApplicationStatus

func (*Application) TerminateApplication

func (a *Application) TerminateApplication()

type ApplicationConfiguration

type ApplicationConfiguration struct {
	Goals    map[string]*GoalConfiguration `json:"goals"`
	MainGoal string                        `json:"main_goal"`
}

func (*ApplicationConfiguration) Clone

func (*ApplicationConfiguration) Validate

func (c *ApplicationConfiguration) Validate() error

type ApplicationStatus

type ApplicationStatus struct {
	Name     string                `json:"name"`
	Goals    map[string]GoalStatus `json:"goals"`
	MainGoal string                `json:"main_goal"`
}

type AuthConfiguration

type AuthConfiguration struct {
	Username      string `json:"username,omitempty"`
	Password      string `json:"password,omitempty"`
	Email         string `json:"email,omitempty"`
	ServerAddress string `json:"serveraddress,omitempty"`
}

TODO { "identitytoken": "9cbaf023786cd7..." }

type Goal

type Goal struct {
	sync.Mutex

	Name                 string
	ApplicationName      string
	DockerClient         *client.Client
	CurrentStatus        string
	Goals                map[string]*Goal
	RunAfterStatuses     map[string]string
	LinksStatuses        map[string]string
	UpstreamGoalStatuses map[string]string
	ShouldRun            bool
	ImageExists          bool
	AuthConfig           AuthConfiguration
	SmartRestart         bool

	ContainerId *string
	ExitCode    *int

	*emission.Emitter
	// contains filtered or unexported fields
}

func NewGoal

func NewGoal(application *Application, goalName string, applicationName string, configs map[string]*GoalConfiguration, dockerClient *client.Client) *Goal

func (*Goal) AddLineToTail

func (g *Goal) AddLineToTail(line string)

func (*Goal) AddStats

func (goal *Goal) AddStats(st types.StatsJSON)

func (*Goal) ContainerStarted

func (goal *Goal) ContainerStarted()

func (*Goal) FetchImage

func (goal *Goal) FetchImage()

func (*Goal) FetchImageFailed

func (goal *Goal) FetchImageFailed(reason string)

func (*Goal) FetchImageFinished

func (goal *Goal) FetchImageFinished()

func (*Goal) GetContainerID

func (goal *Goal) GetContainerID() *string

func (*Goal) HandleDockerEvent

func (goal *Goal) HandleDockerEvent(evt events.Message)

func (*Goal) Inspect

func (goal *Goal) Inspect() (types.ContainerJSON, error)

TODO move this down the chain - application level

func (*Goal) SetContainerID

func (goal *Goal) SetContainerID(containerID string)

func (*Goal) SetCurrentStatus

func (goal *Goal) SetCurrentStatus(status string)

func (*Goal) SetExitCode

func (goal *Goal) SetExitCode(exitCode int)

func (*Goal) SiblingStatusUpdate

func (goal *Goal) SiblingStatusUpdate(goalName, status string)

func (*Goal) Start

func (goal *Goal) Start()

func (*Goal) Status

func (goal *Goal) Status() GoalStatus

func (*Goal) StopContainer

func (goal *Goal) StopContainer()

func (*Goal) Tail

func (g *Goal) Tail() string

func (*Goal) TerminateGoal

func (goal *Goal) TerminateGoal()

type GoalConfiguration

type GoalConfiguration struct {
	Image         string            `json:"image"`
	Command       []string          `json:"command,omitempty"`
	RunAfter      []string          `json:"run_after,omitempty"`
	Links         []string          `json:"links,omitempty"`
	ExtraHosts    []string          `json:"extra_hosts,omitempty"`
	Ports         []string          `json:"ports,omitempty"`
	Expose        []string          `json:"expose,omitempty"`
	Volumes       []string          `json:"volumes,omitempty"`
	Environment   map[string]string `json:"environment,omitempty"`
	Labels        map[string]string `json:"labels,omitempty"`
	LogDriver     string            `json:"log_driver,omitempty"`
	LogConfig     map[string]string `json:"log_config,omitempty"`
	Net           string            `json:"net,omitempty"`
	Dns           []string          `json:"dns,omitempty"`
	CapAdd        []string          `json:"cap_add,omitempty"`
	CapDrop       []string          `json:"cap_drop,omitempty"`
	DNSSearch     []string          `json:"dns_search,omitempty"`
	Devices       []string          `json:"devices,omitempty"`
	SecurityOpt   []string          `json:"security_opt,omitempty"`
	WorkingDir    string            `json:"working_dir,omitempty"`
	Entrypoint    []string          `json:"entrypoint,omitempty"`
	User          string            `json:"user,omitempty"`
	Hostname      string            `json:"hostname,omitempty"`
	Domainname    string            `json:"domainname,omitempty"`
	MacAddress    string            `json:"mac_address,omitempty"`
	MemLimit      int64             `json:"mem_limit,omitempty"`
	MemSwapLimit  int64             `json:"memswap_limit,omitempty"`
	Privileged    bool              `json:"privileged,omitempty"`
	Restart       string            `json:"restart,omitempty"`
	StdinOpen     bool              `json:"stdin_open,omitempty"`
	AttachStdin   bool              `json:"attach_stdin,omitempty"`
	AttachStdout  bool              `json:"attach_stdout,omitempty"`
	AttachStderr  bool              `json:"attach_stderr,omitempty"`
	Tty           bool              `json:"tty,omitempty"`
	CpuShares     int64             `json:"cpu_shares,omitempty"`
	CpuSet        string            `json:"cpuset,omitempty"`
	ReadOnly      bool              `json:"read_only,omitempty"`
	VolumeDriver  string            `json:"volume_driver,omitempty"`
	AuthConfig    AuthConfiguration `json:"auth_config,omitempty"`
	ContainerName string            `json:"container_name,omitempty"`
	ExternalLinks []string          `json:"external_links,omitempty"`
	SmartRestart  bool              `json:"smart_restart,omitempty"`
}

func (*GoalConfiguration) Clone

func (gc *GoalConfiguration) Clone() *GoalConfiguration

func (*GoalConfiguration) LinkedContainers

func (gc *GoalConfiguration) LinkedContainers() []LinkedContainer

type GoalEvent

type GoalEvent struct {
	Name  string
	Event string
}

type GoalStatus

type GoalStatus struct {
	Name     string `json:"name"`
	Status   string `json:"status"`
	ExitCode *int   `json:"exit_code,omitempty"`
}

type LinkedContainer

type LinkedContainer struct {
	Name  string
	Alias string
}

type TransitionLogEntry

type TransitionLogEntry struct {
	Time   time.Time `json:"time"`
	Status string    `json:"status"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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