Documentation
¶
Index ¶
- Constants
- func InDependencyOrder(ctx context.Context, project *types.Project, ...) error
- func InReverseDependencyOrder(ctx context.Context, project *types.Project, ...) error
- func NewComposeService(apiClient client.APIClient, configFile *configfile.ConfigFile) compose.Service
- type Containers
- type ContainersKey
- type ContainersState
- type Graph
- func (g *Graph) AddEdge(source string, destination string) error
- func (g *Graph) AddVertex(key string, service types.ServiceConfig, initialStatus ServiceStatus)
- func (g *Graph) FilterChildren(key string, status ServiceStatus) []*Vertex
- func (g *Graph) FilterParents(key string, status ServiceStatus) []*Vertex
- func (g *Graph) HasCycles() (bool, error)
- func (g *Graph) Leaves() []*Vertex
- func (g *Graph) Roots() []*Vertex
- func (g *Graph) UpdateStatus(key string, status ServiceStatus)
- type ServiceStatus
- type Vertex
Constants ¶
const (
// ComposeVersion Compose version
ComposeVersion = "1.0-alpha"
)
Variables ¶
This section is empty.
Functions ¶
func InDependencyOrder ¶
func InDependencyOrder(ctx context.Context, project *types.Project, fn func(context.Context, types.ServiceConfig) error) error
InDependencyOrder applies the function to the services of the project taking in account the dependency order
func InReverseDependencyOrder ¶
func InReverseDependencyOrder(ctx context.Context, project *types.Project, fn func(context.Context, types.ServiceConfig) error) error
InReverseDependencyOrder applies the function to the services of the project in reverse order of dependencies
func NewComposeService ¶
func NewComposeService(apiClient client.APIClient, configFile *configfile.ConfigFile) compose.Service
NewComposeService create a local implementation of the compose.Service API
Types ¶
type Containers ¶ added in v1.0.7
Containers is a set of moby Container
type ContainersKey ¶ added in v1.0.9
type ContainersKey struct{}
ContainersKey is the context key to access context value os a ContainersStatus
type ContainersState ¶ added in v1.0.9
type ContainersState interface {
Get(string) *types.Container
GetContainers() Containers
Add(c types.Container)
AddAll(cs Containers)
Remove(string) types.Container
}
ContainersState state management interface
func GetContextContainerState ¶ added in v1.0.9
func GetContextContainerState(ctx context.Context) (ContainersState, error)
GetContextContainerState gets the container state manager
func NewContainersState ¶ added in v1.0.9
func NewContainersState(cs Containers) ContainersState
NewContainersState creates a new container state manager
type Graph ¶
Graph represents project as service dependencies
func NewGraph ¶
func NewGraph(services types.Services, initialStatus ServiceStatus) *Graph
NewGraph returns the dependency graph of the services
func (*Graph) AddEdge ¶
AddEdge adds a relationship of dependency between vertexes `source` and `destination`
func (*Graph) AddVertex ¶
func (g *Graph) AddVertex(key string, service types.ServiceConfig, initialStatus ServiceStatus)
AddVertex adds a vertex to the Graph
func (*Graph) FilterChildren ¶
func (g *Graph) FilterChildren(key string, status ServiceStatus) []*Vertex
FilterChildren returns children of a certain vertex that are in a certain status
func (*Graph) FilterParents ¶
func (g *Graph) FilterParents(key string, status ServiceStatus) []*Vertex
FilterParents returns the parents of a certain vertex that are in a certain status
func (*Graph) UpdateStatus ¶
func (g *Graph) UpdateStatus(key string, status ServiceStatus)
UpdateStatus updates the status of a certain vertex
type ServiceStatus ¶
type ServiceStatus int
ServiceStatus indicates the status of a service
const ( ServiceStopped ServiceStatus = iota ServiceStarted )
Services status flags
type Vertex ¶
type Vertex struct {
Key string
Service types.ServiceConfig
Status ServiceStatus
Children map[string]*Vertex
Parents map[string]*Vertex
}
Vertex represents a service in the dependencies structure
func NewVertex ¶
func NewVertex(key string, service types.ServiceConfig, initialStatus ServiceStatus) *Vertex
NewVertex is the constructor function for the Vertex
func (*Vertex) GetChildren ¶
GetChildren returns a slice with the child vertexes of the a Vertex
func (*Vertex) GetParents ¶
GetParents returns a slice with the parent vertexes of the a Vertex