本文整理匯總了Golang中github.com/openshift/origin/pkg/api/graph.NodeSet.Add方法的典型用法代碼示例。如果您正苦於以下問題:Golang NodeSet.Add方法的具體用法?Golang NodeSet.Add怎麽用?Golang NodeSet.Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/openshift/origin/pkg/api/graph.NodeSet
的用法示例。
在下文中一共展示了NodeSet.Add方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: findBuildInputs
func findBuildInputs(g osgraph.Graph, n graph.Node, covered osgraph.NodeSet) (base ImageTagLocation, source SourceLocation, err error) {
// find inputs to the build
for _, input := range g.Neighbors(n) {
switch g.EdgeKind(g.EdgeBetween(n, input)) {
case buildedges.BuildInputEdgeKind:
if source != nil {
// report this as an error (unexpected duplicate source)
}
covered.Add(input.ID())
source = input.(SourceLocation)
case buildedges.BuildInputImageEdgeKind:
if base != nil {
// report this as an error (unexpected duplicate input build)
}
covered.Add(input.ID())
base = input.(ImageTagLocation)
}
}
return
}
示例2: ImagePipelineFromNode
// ImagePipelineFromNode attempts to locate a build flow from the provided node. If no such
// build flow can be located, false is returned.
func ImagePipelineFromNode(g osgraph.Graph, n graph.Node, covered osgraph.NodeSet) (ImagePipeline, bool) {
flow := ImagePipeline{}
switch node := n.(type) {
case *buildgraph.BuildConfigNode:
covered.Add(n.ID())
base, src, _ := findBuildInputs(g, n, covered)
flow.Build = node
flow.BaseImage = base
flow.Source = src
return flow, true
case ImageTagLocation:
covered.Add(n.ID())
flow.Image = node
for _, input := range g.Neighbors(n) {
switch g.EdgeKind(g.EdgeBetween(n, input)) {
case buildedges.BuildOutputEdgeKind:
covered.Add(input.ID())
build := input.(*buildgraph.BuildConfigNode)
if flow.Build != nil {
// report this as an error (unexpected duplicate input build)
}
if build.BuildConfig == nil {
// report this as as a missing build / broken link
break
}
base, src, _ := findBuildInputs(g, input, covered)
flow.Build = build
flow.BaseImage = base
flow.Source = src
}
}
return flow, true
default:
return flow, false
}
}