project

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const RelTypeDependsOn = ServiceRelationshipType("dependsOn")

RelTypeDependsOn means the dependency was explicitly set using 'depends_on'.

View Source
const RelTypeIpcNamespace = ServiceRelationshipType("ipc")

RelTypeIpcNamespace means the service share the same ipc namespace.

View Source
const RelTypeLink = ServiceRelationshipType("")

RelTypeLink means the services are linked (docker links).

View Source
const RelTypeNetNamespace = ServiceRelationshipType("netns")

RelTypeNetNamespace means the services share the same network namespace.

View Source
const RelTypeNetworkMode = ServiceRelationshipType("networkMode")

RelTypeNetworkMode means the services depends on another service on networkMode

View Source
const RelTypeVolumesFrom = ServiceRelationshipType("volumesFrom")

RelTypeVolumesFrom means the services share some volumes.

Variables

View Source
var (
	StateExecuted = ServiceState("executed")
	StateUnknown  = ServiceState("unknown")
)

State definitions

View Source
var (
	ErrRestart     = errors.New("Restart execution")
	ErrUnsupported = errors.New("UnsupportedOperation")
)

Error definitions

Functions

func IsNamedVolume

func IsNamedVolume(volume string) bool

IsNamedVolume returns whether the specified volume (string) is a named volume or not.

func NameAlias

func NameAlias(name string) (string, string)

NameAlias returns the name and alias based on the specified string. If the name contains a colon (like name:alias) it will split it, otherwise it will return the specified name as name and alias.

func NewDefaultListener

func NewDefaultListener(p *Project) chan<- events.Event

NewDefaultListener create a default listener for the specified project.

Types

type Context

type Context struct {
	ComposeFiles []string
	ComposeBytes [][]byte
	ProjectName  string

	ServiceFactory      ServiceFactory
	ContainerFactory    ServiceFactory
	DependenciesFactory DependenciesFactory
	VolumesFactory      VolumesFactory
	SecretsFactory      SecretsFactory
	HostsFactory        HostsFactory
	EnvironmentLookup   config.EnvironmentLookup
	ResourceLookup      config.ResourceLookup
	LoggerFactory       logger.Factory
	Project             *Project
	// contains filtered or unexported fields
}

Context holds context meta information about a libcompose project, like the project name, the compose file, etc.

type Dependencies added in v0.14.0

type Dependencies interface {
	Initialize(ctx context.Context) error
}

type DependenciesFactory added in v0.14.0

type DependenciesFactory interface {
	Create(projectName string, dependencyConfigs map[string]*config.DependencyConfig) (Dependencies, error)
}

type EmptyService

type EmptyService struct {
}

EmptyService is a struct that implements Service but does nothing.

func (*EmptyService) Build

func (e *EmptyService) Build(ctx context.Context, buildOptions options.Build) error

Build implements Service.Build but does nothing.

func (*EmptyService) Config

func (e *EmptyService) Config() *config.ServiceConfig

Config implements Service.Config with empty config.

func (*EmptyService) Create

func (e *EmptyService) Create(ctx context.Context, options options.Create) error

Create implements Service.Create but does nothing.

func (*EmptyService) DependentServices

func (e *EmptyService) DependentServices() []ServiceRelationship

DependentServices implements Service.DependentServices with empty slice.

func (*EmptyService) Log

func (e *EmptyService) Log(ctx context.Context, follow bool) error

Log implements Service.Log but does nothing.

func (*EmptyService) Name

func (e *EmptyService) Name() string

Name implements Service.Name with empty name.

func (*EmptyService) Up

func (e *EmptyService) Up(ctx context.Context, options options.Up) error

Up implements Service.Up but does nothing.

type Hosts added in v0.14.0

type Hosts interface {
	Initialize(ctx context.Context) error
}

type HostsFactory added in v0.14.0

type HostsFactory interface {
	Create(projectName string, hostConfigs map[string]*client.Host) (Hosts, error)
}

type Project

type Project struct {
	Name              string
	ServiceConfigs    *config.ServiceConfigs
	ContainerConfigs  *config.ServiceConfigs
	DependencyConfigs map[string]*config.DependencyConfig
	VolumeConfigs     map[string]*config.VolumeConfig
	NetworkConfigs    map[string]*config.NetworkConfig
	SecretConfigs     map[string]*config.SecretConfig
	HostConfigs       map[string]*client.Host
	Files             []string
	ReloadCallback    func() error
	// contains filtered or unexported fields
}

Project holds libcompose project information.

func NewProject

func NewProject(context *Context) *Project

NewProject creates a new project with the specified context.

func (*Project) AddListener

func (p *Project) AddListener(c chan<- events.Event)

AddListener adds the specified listener to the project. This implements implicitly events.Emitter.

func (*Project) Build

func (p *Project) Build(ctx context.Context, buildOptions options.Build, services ...string) error

func (*Project) Create

func (p *Project) Create(ctx context.Context, options options.Create, services ...string) error

func (*Project) CreateService

func (p *Project) CreateService(name string) (Service, error)

func (*Project) Log

func (p *Project) Log(ctx context.Context, follow bool, services ...string) error

func (*Project) Notify

func (p *Project) Notify(eventType events.EventType, serviceName string, data map[string]string)

Notify notifies all project listener with the specified eventType, service name and datas. This implements implicitly events.Notifier interface.

func (*Project) Parse

func (p *Project) Parse() error

Parse populates project information based on its context. It sets up the name, the composefile and the composebytes (the composefile content).

func (*Project) Up

func (p *Project) Up(ctx context.Context, options options.Up, services ...string) error

type Secrets added in v0.14.0

type Secrets interface {
	Initialize(ctx context.Context) error
}

type SecretsFactory added in v0.14.0

type SecretsFactory interface {
	Create(projectName string, secretConfigs map[string]*config.SecretConfig) (Secrets, error)
}

type Service

type Service interface {
	Build(ctx context.Context, buildOptions options.Build) error
	Create(ctx context.Context, options options.Create) error
	Log(ctx context.Context, follow bool) error
	Up(ctx context.Context, options options.Up) error

	DependentServices() []ServiceRelationship
	Config() *config.ServiceConfig
	Name() string
}

Service defines what a libcompose service provides.

type ServiceFactory

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

ServiceFactory is an interface factory to create Service object for the specified project, with the specified name and service configuration.

type ServiceRelationship

type ServiceRelationship struct {
	Target, Alias string
	Type          ServiceRelationshipType
	Optional      bool
}

ServiceRelationship holds the relationship information between two services.

func DefaultDependentServices

func DefaultDependentServices(p *Project, s Service) []ServiceRelationship

DefaultDependentServices return the dependent services (as an array of ServiceRelationship) for the specified project and service. It looks for : links, volumesFrom, net and ipc configuration.

func NewServiceRelationship

func NewServiceRelationship(nameAlias string, relType ServiceRelationshipType) ServiceRelationship

NewServiceRelationship creates a new Relationship based on the specified alias and relationship type.

type ServiceRelationshipType

type ServiceRelationshipType string

ServiceRelationshipType defines the type of service relationship.

type ServiceState

type ServiceState string

ServiceState holds the state of a service.

type Volumes

type Volumes interface {
	Initialize(ctx context.Context) error
}

type VolumesFactory

type VolumesFactory interface {
	Create(projectName string, volumeConfigs map[string]*config.VolumeConfig, serviceConfigs *config.ServiceConfigs) (Volumes, error)
}

Directories

Path Synopsis
Package events holds event structures, methods and functions.
Package events holds event structures, methods and functions.

Jump to

Keyboard shortcuts

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