model

package
v0.0.0-...-0cb6cf9 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidIdentifier

func IsValidIdentifier(s string) bool

IsValidIdentifier returns true if and only if s is a valid identifier.

Types

type DependencyRef

type DependencyRef struct {
	Type           string `hcl:"type,attr"`
	Name           string `hcl:"name,attr"`
	WaitForHealthy bool   `hcl:"wait_for_healthy,optional"`
}

DependencyRef is a block that defines the parameters of a specific dependency relationship to exactly one deployment.

func (DependencyRef) DeploymentRef

func (r DependencyRef) DeploymentRef() DeploymentRef

DeploymentRef returns the DeploymentRef for r.

type DependencySpec

type DependencySpec struct {
	Type           string   `hcl:"type,attr"`
	Name           string   `hcl:"name,optional"`
	WaitForHealthy bool     `hcl:"wait_for_healthy,optional"`
	Filters        []Filter `hcl:"filter,block"`
}

DependencySpec is a block that defines the parameters of an abstract dependency relationship to zero or more deployments. A DependencySpec can take one of two forms: it can be identical to a DependencyRef, or it can omit the dependent's name and use zero or more filter blocks to narrow down the targets. In the latter form, the dependent's type can be specified as "*" to target all types of deployments.

type Deployment

type Deployment struct {
	Type         string           `hcl:"type,label"`
	Name         string           `hcl:"name,label"`
	Framework    string           `hcl:"framework,optional"`
	Deploy       string           `hcl:"deploy,attr"`
	Labels       []string         `hcl:"labels,optional"`
	Dependencies []DependencySpec `hcl:"dependency,block"`
	DependencyOf []DependencySpec `hcl:"dependency_of,block"`
}

Deployment is a block that defines the parameters of a deployment into a Mesos framework. If the framework is not specified, it is identical to the value "default".

func (*Deployment) Ref

func (d *Deployment) Ref() DeploymentRef

Ref returns the DeploymentRef for d.

type DeploymentRef

type DeploymentRef struct {
	Type string `hcl:"type,attr"`
	Name string `hcl:"name,attr"`
}

DeploymentRef is a block that references a deployment.

type Filter

type Filter struct {
	Key    string   `hcl:"key,attr"`
	Value  string   `hcl:"value,optional"`
	Values []string `hcl:"values,optional"`
	Glob   bool     `hcl:"glob,optional"`
	Regexp bool     `hcl:"regexp,optional"`
	Negate bool     `hcl:"negate,optional"`
}

Filter is a block that specifies the criteria used to narrow down the targets of a dependency relationship.

type Framework

type Framework struct {
	Type                string         `hcl:"type,label"`
	Name                string         `hcl:"name,label"`
	MesosName           string         `hcl:"mesos_name,attr"`
	Masters             []string       `hcl:"masters,attr"`
	CreatedByDeployment *DeploymentRef `hcl:"created_by_deployment,block"`
}

Framework is a block that specifies the parameters of a Mesos framework, such as Marathon or Chronos.

func (*Framework) Ref

func (f *Framework) Ref() FrameworkRef

Ref returns the FrameworkRef for f.

type FrameworkRef

type FrameworkRef struct {
	Type string `hcl:"type,attr"`
	Name string `hcl:"name,attr"`
}

FrameworkRef is a block that references a framework.

type Graph

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

Graph is a graph of deployments connected by their dependencies. Ideally, this should be a directed acyclic graph (DAG) and some methods will return errors if the graph is not a DAG. A graph g is a DAG if len(g.Cycles()) == 0.

func (*Graph) Build

func (g *Graph) Build(deployments ...Deployment) error

Build builds a graph from the given deployments. Returns a non-nil error if the graph has already been built, if any of the explicit dependencies can't be resolved, or if any of the dependency filters are invalid.

func (*Graph) Cycles

func (g *Graph) Cycles() [][]DeploymentRef

Cycles returns a list of all dependency cycles in the graph.

func (*Graph) Dependencies

func (g *Graph) Dependencies(deployment DeploymentRef) ([]DependencyRef, error)

Dependencies returns a list of all resolved dependencies for a deployment. Returns a non-nil error if and only if the deployment is not in the graph.

func (*Graph) DeployOrder

func (g *Graph) DeployOrder() ([]DeploymentRef, error)

DeployOrder returns a list of all deployments in the graph, sorted in the order they would be deployed. This is equivalent to a reverse topological sort of the dependency graph. Returns a non-nil error if and only if there are cycles in the graph.

type Mesos

type Mesos struct {
	Zookeepers string   `hcl:"zookeepers,attr"`
	Masters    []string `hcl:"masters,attr"`
}

Mesos is a block that specifies the parameters of an Apache Mesos cluster.

type Root

type Root struct {
	Mesos       *Mesos       `hcl:"mesos,block"`
	Frameworks  []Framework  `hcl:"framework,block"`
	Deployments []Deployment `hcl:"deployment,block"`
}

Root is the root of a declarative configuration, consisting of a mesos block, one or more framework blocks, and one or more deployment blocks.

Jump to

Keyboard shortcuts

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