Documentation ¶
Index ¶
- Constants
- func InDependencyOrder(ctx context.Context, project *types.Project, ...) error
- func InReverseDependencyOrder(ctx context.Context, project *types.Project, ...) error
- 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 ¶
Types ¶
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