本文整理匯總了Golang中github.com/openshift/origin/pkg/api/graph.Graph.RemoveNode方法的典型用法代碼示例。如果您正苦於以下問題:Golang Graph.RemoveNode方法的具體用法?Golang Graph.RemoveNode怎麽用?Golang Graph.RemoveNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/openshift/origin/pkg/api/graph.Graph
的用法示例。
在下文中一共展示了Graph.RemoveNode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: pruneImages
// pruneImages invokes imagePruneFunc with each image that is prunable, along
// with the image streams that reference the image. After imagePruneFunc is
// invoked, the image node is removed from the graph, so that layers eligible
// for pruning may later be identified.
func pruneImages(g graph.Graph, imageNodes []*graph.ImageNode, pruneImage ImagePruneFunc, pruneStream ImageStreamPruneFunc, pruneManifest ManifestPruneFunc) {
for _, imageNode := range imageNodes {
glog.V(4).Infof("Examining image %q", imageNode.Image.Name)
if !imageIsPrunable(g, imageNode) {
glog.V(4).Infof("Image has strong references - not pruning")
continue
}
glog.V(4).Infof("Image has only weak references - pruning")
if err := pruneImage(imageNode.Image); err != nil {
util.HandleError(fmt.Errorf("error pruning image %q: %v", imageNode.Image.Name, err))
}
for _, n := range g.Predecessors(imageNode) {
if streamNode, ok := n.(*graph.ImageStreamNode); ok {
stream := streamNode.ImageStream
repoName := fmt.Sprintf("%s/%s", stream.Namespace, stream.Name)
glog.V(4).Infof("Pruning image from stream %s", repoName)
updatedStream, err := pruneStream(stream, imageNode.Image)
if err != nil {
util.HandleError(fmt.Errorf("error pruning image from stream: %v", err))
continue
}
streamNode.ImageStream = updatedStream
ref, err := imageapi.DockerImageReferenceForStream(stream)
if err != nil {
util.HandleError(fmt.Errorf("error constructing DockerImageReference for %q: %v", repoName, err))
continue
}
glog.V(4).Infof("Invoking pruneManifest for registry %q, repo %q, image %q", ref.Registry, repoName, imageNode.Image.Name)
if err := pruneManifest(ref.Registry, repoName, imageNode.Image.Name); err != nil {
util.HandleError(fmt.Errorf("error pruning manifest for registry %q, repo %q, image %q: %v", ref.Registry, repoName, imageNode.Image.Name, err))
}
}
}
// remove pruned image node from graph, for layer pruning later
g.RemoveNode(imageNode)
}
}