resolver

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DepthInfinite = -1

	DefaultFile = "lattice.yaml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Resolve(
		c component.Interface,
		id v1.SystemID,
		path tree.Path,
		ctx *git.CommitReference,
		depth int,
	) (*ResolutionTree, error)
	Versions(component.Interface, semver.Range) ([]string, error)
}

func NewComponentResolver

func NewComponentResolver(
	gitResolver *git.Resolver,
	templateStore TemplateStore,
	secretStore SecretStore,
) Interface

type ResolutionInfo

type ResolutionInfo struct {
	// Component contains the hydrated but unresolved version of the component.
	// That is, if the component is a v1/system, it may contain unresolved references.
	Component component.Interface
	Commit    *git.CommitReference
	// TODO(kevindrosendahl): probably want to move this out when we have a more
	// concrete theory on component resolution secrets.
	SSHKeySecret *tree.PathSubcomponent
}

ResolutionInfo contains information about the resolution of a subcomponent.

func (*ResolutionInfo) MarshalJSON

func (i *ResolutionInfo) MarshalJSON() ([]byte, error)

func (*ResolutionInfo) UnmarshalJSON

func (i *ResolutionInfo) UnmarshalJSON(data []byte) error

type ResolutionTree

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

ResolutionTree provides efficient path-based access to info about the resolution of a given tree of components.

func NewResolutionTree

func NewResolutionTree() *ResolutionTree

NewResolutionTree returns an initialized ResolutionTree.

func (*ResolutionTree) Delete

func (t *ResolutionTree) Delete(p tree.Path) (*ResolutionInfo, bool)

Delete removes component resolution information about a path.

func (*ResolutionTree) Get

func (t *ResolutionTree) Get(p tree.Path) (*ResolutionInfo, bool)

Get retrieves component resolution information about a path.

func (*ResolutionTree) Insert

Insert adds component resolution information about a path.

func (*ResolutionTree) Len

func (t *ResolutionTree) Len() int

Len returns the number of elements in the tree.

func (*ResolutionTree) MarshalJSON

func (t *ResolutionTree) MarshalJSON() ([]byte, error)

MarshalJSON fulfills the json.Marshaller interface.

func (*ResolutionTree) ReplacePrefix

func (t *ResolutionTree) ReplacePrefix(p tree.Path, other *ResolutionTree)

ReplacePrefix removes existing component resolution information about a path and all paths below it, and replaces it with the information from the supplied ResolutionTree.

func (*ResolutionTree) UnmarshalJSON

func (t *ResolutionTree) UnmarshalJSON(data []byte) error

MarshalJSON fulfills the json.Unmarshaller interface.

func (*ResolutionTree) V1

func (t *ResolutionTree) V1() *V1Tree

V1 returns a V1 tree allowing retrieval of v1 components in the tree.

func (*ResolutionTree) Walk

Walk walks the resolution tree, invoking the supplied function on each path.

type ResolutionTreeWalkFn

type ResolutionTreeWalkFn func(tree.Path, *ResolutionInfo) tree.WalkContinuation

ResolutionTreeWalkFn is the function type invoked during a resolution tree walk.

type SecretDoesNotExistError

type SecretDoesNotExistError struct{}

func (*SecretDoesNotExistError) Error

func (e *SecretDoesNotExistError) Error() string

type SecretStore

type SecretStore interface {
	Ready() bool
	Get(systemID v1.SystemID, path tree.PathSubcomponent) (string, error)
}

type TemplateDoesNotExistError

type TemplateDoesNotExistError struct{}

func (*TemplateDoesNotExistError) Error

func (e *TemplateDoesNotExistError) Error() string

type TemplateStore

type TemplateStore interface {
	Ready() bool
	Put(systemID v1.SystemID, ref *git.FileReference, t *template.Template) error
	Get(systemID v1.SystemID, ref *git.FileReference) (*template.Template, error)
}

type V1Tree

type V1Tree struct {
	*ResolutionTree
}

V1Tree provides an overlay on top of a resolution tree to access v1 components in the tree.

func (*V1Tree) Jobs

func (t *V1Tree) Jobs(fn V1TreeJobWalkFn)

Jobs walks the resolution tree, invoking the supplied function on each path that contains a v1/job.

func (*V1Tree) NodePools

func (t *V1Tree) NodePools(fn V1TreeNodePoolWalkFn)

NodePools walks the resolution tree, invoking the supplied function on each path that contains a v1/node-pool.

func (*V1Tree) References

func (t *V1Tree) References(fn V1TreeReferenceWalkFn)

References walks the resolution tree, invoking the supplied function on each path that contains a v1/reference.

func (*V1Tree) Services

func (t *V1Tree) Services(fn V1TreeServiceWalkFn)

Services walks the resolution tree, invoking the supplied function on each path that contains a v1/services.

func (*V1Tree) Systems

func (t *V1Tree) Systems(fn V1TreeSystemWalkFn)

Systems walks the resolution tree, invoking the supplied function on each path that contains a v1/system.

func (*V1Tree) Workloads

func (t *V1Tree) Workloads(fn V1TreeWorkloadWalkFn)

Workloads walks the resolution tree, invoking the supplied function on each path whose component fulfills the Workload interface.

type V1TreeJobWalkFn

type V1TreeJobWalkFn func(tree.Path, *definitionv1.Job, *ResolutionInfo) tree.WalkContinuation

V1TreeJobWalkFn is the function type invoked during a v1 job walk.

type V1TreeNodePoolWalkFn

type V1TreeNodePoolWalkFn func(tree.PathSubcomponent, *definitionv1.NodePool) tree.WalkContinuation

V1TreeNodePoolWalkFn is the function type invoked during a v1 node pool walk.

type V1TreeReferenceWalkFn

type V1TreeReferenceWalkFn func(tree.Path, *definitionv1.Reference, *ResolutionInfo) tree.WalkContinuation

V1TreeReferenceWalkFn is the function type invoked during a v1 reference walk.

type V1TreeServiceWalkFn

type V1TreeServiceWalkFn func(tree.Path, *definitionv1.Service, *ResolutionInfo) tree.WalkContinuation

V1TreeServiceWalkFn is the function type invoked during a v1 service walk.

type V1TreeSystemWalkFn

type V1TreeSystemWalkFn func(tree.Path, *definitionv1.System, *ResolutionInfo) tree.WalkContinuation

V1TreeSystemWalkFn is the function type invoked during a v1 system walk.

type V1TreeWorkloadWalkFn

type V1TreeWorkloadWalkFn func(tree.Path, definitionv1.Workload, *ResolutionInfo) tree.WalkContinuation

V1TreeWorkloadWalkFn is the function type invoked during a v1 workload walk.

Directories

Path Synopsis
Package tests implements tests for component resolution.
Package tests implements tests for component resolution.

Jump to

Keyboard shortcuts

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