當前位置: 首頁>>代碼示例>>Golang>>正文


Golang NodeSet.Has方法代碼示例

本文整理匯總了Golang中github.com/openshift/origin/pkg/api/graph.NodeSet.Has方法的典型用法代碼示例。如果您正苦於以下問題:Golang NodeSet.Has方法的具體用法?Golang NodeSet.Has怎麽用?Golang NodeSet.Has使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/openshift/origin/pkg/api/graph.NodeSet的用法示例。


在下文中一共展示了NodeSet.Has方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: UncoveredDeploymentFlowNodes

// UncoveredDeploymentFlowNodes includes nodes that either services or deployment
// configs, or which haven't previously been covered.
func UncoveredDeploymentFlowNodes(covered osgraph.NodeSet) osgraph.NodeFunc {
	return func(g osgraph.Interface, node graph.Node) bool {
		switch node.(type) {
		case *deploygraph.DeploymentConfigNode, *kubegraph.ServiceNode:
			return true
		}
		return !covered.Has(node.ID())
	}
}
開發者ID:cjnygard,項目名稱:origin,代碼行數:11,代碼來源:deployment.go

示例2: UncoveredDeploymentFlowEdges

// UncoveredDeploymentFlowEdges preserves (and duplicates) edges that were not
// covered by a deployment flow. As a special case, it preserves edges between
// Services and DeploymentConfigs.
func UncoveredDeploymentFlowEdges(covered osgraph.NodeSet) osgraph.EdgeFunc {
	return func(g osgraph.Interface, head, tail graph.Node, edgeKind string) bool {
		if edgeKind == kubeedges.ExposedThroughServiceEdgeKind {
			return osgraph.AddReversedEdge(g, head, tail, osgraph.ReferencedByEdgeKind)
		}
		if covered.Has(head.ID()) && covered.Has(tail.ID()) {
			return false
		}
		return osgraph.AddReversedEdge(g, head, tail, osgraph.ReferencedByEdgeKind)
	}
}
開發者ID:cjnygard,項目名稱:origin,代碼行數:14,代碼來源:deployment.go

示例3: subgraphWithoutPrunableImages

// subgraphWithoutPrunableImages creates a subgraph from g with prunable image
// nodes excluded.
func subgraphWithoutPrunableImages(g graph.Graph, prunableImageIDs graph.NodeSet) graph.Graph {
	return g.Subgraph(
		func(g graph.Interface, node gonum.Node) bool {
			return !prunableImageIDs.Has(node.ID())
		},
		func(g graph.Interface, head, tail gonum.Node, edgeKinds util.StringSet) bool {
			if prunableImageIDs.Has(head.ID()) {
				return false
			}
			if prunableImageIDs.Has(tail.ID()) {
				return false
			}
			return true
		},
	)
}
開發者ID:jhadvig,項目名稱:origin,代碼行數:18,代碼來源:imagepruner.go

示例4: subgraphWithoutPrunableImages

// subgraphWithoutPrunableImages creates a subgraph from g with prunable image
// nodes excluded.
func subgraphWithoutPrunableImages(g graph.Graph, prunableImageIDs graph.NodeSet) graph.Graph {
	return g.Subgraph(
		func(g graph.Interface, node gonum.Node) bool {
			return !prunableImageIDs.Has(node.ID())
		},
		func(g graph.Interface, from, to gonum.Node, edgeKinds sets.String) bool {
			if prunableImageIDs.Has(from.ID()) {
				return false
			}
			if prunableImageIDs.Has(to.ID()) {
				return false
			}
			return true
		},
	)
}
開發者ID:RomainVabre,項目名稱:origin,代碼行數:18,代碼來源:imagepruner.go


注:本文中的github.com/openshift/origin/pkg/api/graph.NodeSet.Has方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。