project

package
v0.3.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONTAINER_ID = "container_id"

	CONTAINER_STARTING = Event("Starting container")
	CONTAINER_CREATED  = Event("Created container")
	CONTAINER_STARTED  = Event("Started container")

	SERVICE_ADD      = Event("Adding")
	SERVICE_UP_START = Event("Starting")
	SERVICE_UP       = Event("Started")

	PROJECT_UP_START       = Event("Starting project")
	PROJECT_RELOAD         = Event("Reloading project")
	PROJECT_RELOAD_TRIGGER = Event("Triggering project reload")
)

Variables

View Source
var (
	EXECUTED   ServiceState = ServiceState("executed")
	UNKNOWN    ServiceState = ServiceState("unknown")
	ErrRestart error        = errors.New("Restart execution")
)

Functions

This section is empty.

Types

type EnvironmentLookup

type EnvironmentLookup interface {
	Lookup(key, serviceName string, config *ServiceConfig) []string
}

type Event

type Event string

type Project

type Project struct {
	EnvironmentLookup EnvironmentLookup
	Name              string

	Services map[string]Service

	ReloadCallback func() error
	// contains filtered or unexported fields
}

func NewProject

func NewProject(name string, factory ServiceFactory) *Project

func (*Project) AddConfig

func (p *Project) AddConfig(name string, config *ServiceConfig) error

func (*Project) AddListener

func (p *Project) AddListener(c chan<- ProjectEvent)

func (*Project) Load

func (p *Project) Load(bytes []byte) error

func (*Project) Notify

func (p *Project) Notify(event Event, service Service, data map[string]string)

func (*Project) Up

func (p *Project) Up() error

type ProjectEvent

type ProjectEvent struct {
	Event   Event
	Service Service
	Data    map[string]string
}

type Service

type Service interface {
	Name() string
	Up() error
	Config() *ServiceConfig
}

type ServiceConfig

type ServiceConfig struct {
	CapAdd      []string `yaml:"cap_add,omitempty"`
	CapDrop     []string `yaml:"cap_drop,omitempty"`
	CpuShares   int64    `yaml:"cpu_shares,omitempty"`
	Command     string   `yaml:"command,omitempty"`
	Detach      string   `yaml:"detach,omitempty"`
	Dns         []string `yaml:"dns,omitempty"`
	DnsSearch   string   `yaml:"dns_search,omitempty"`
	DomainName  string   `yaml:"domainname,omitempty"`
	Entrypoint  string   `yaml:"entrypoint,omitempty"`
	EnvFile     string   `yaml:"env_file,omitempty"`
	Environment []string `yaml:"environment,omitempty"`
	Hostname    string   `yaml:"hostname,omitempty"`
	Image       string   `yaml:"image,omitempty"`
	Labels      []string `yaml:"labels,omitempty"`
	Links       []string `yaml:"links,omitempty"`
	LogDriver   string   `yaml:"log_driver,omitempty"`
	MemLimit    int64    `yaml:"mem_limit,omitempty"`
	Name        string   `yaml:"name,omitempty"`
	Net         string   `yaml:"net,omitempty"`
	Pid         string   `yaml:"pid,omitempty"`
	Ipc         string   `yaml:"ipc,omitempty"`
	Ports       []string `yaml:"ports,omitempty"`
	Privileged  bool     `yaml:"privileged,omitempty"`
	Restart     string   `yaml:"restart,omitempty"`
	ReadOnly    bool     `yaml:"read_only,omitempty"`
	StdinOpen   bool     `yaml:"stdin_open,omitempty"`
	Tty         bool     `yaml:"tty,omitempty"`
	User        string   `yaml:"user,omitempty"`
	Volumes     []string `yaml:"volumes,omitempty"`
	VolumesFrom []string `yaml:"volumes_from,omitempty"`
	WorkingDir  string   `yaml:"working_dir,omitempty"`
	//`yaml:"build,omitempty"`
	Expose        []string `yaml:"expose,omitempty"`
	ExternalLinks []string `yaml:"external_links,omitempty"`
}

type ServiceFactory

type ServiceFactory interface {
	Create(project *Project, name string, serviceConfig *ServiceConfig) (Service, error)
}

type ServiceState

type ServiceState string

type ServiceWrapper

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

func NewServiceWrapper

func NewServiceWrapper(name string, p *Project) *ServiceWrapper

func (*ServiceWrapper) Reset

func (s *ServiceWrapper) Reset()

func (*ServiceWrapper) Start

func (s *ServiceWrapper) Start(wrappers map[string]*ServiceWrapper)

func (*ServiceWrapper) Wait

func (s *ServiceWrapper) Wait() error

Jump to

Keyboard shortcuts

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