当前位置: 首页>>代码示例>>Golang>>正文


Golang node.NewNode函数代码示例

本文整理汇总了Golang中github.com/docker/swarm/scheduler/node.NewNode函数的典型用法代码示例。如果您正苦于以下问题:Golang NewNode函数的具体用法?Golang NewNode怎么用?Golang NewNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewNode函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: listNodes

// listNodes returns all the engines in the cluster.
func (c *Cluster) listNodes() []*node.Node {
	c.RLock()
	defer c.RUnlock()

	out := make([]*node.Node, 0, len(c.engines))
	for _, n := range c.engines {
		out = append(out, node.NewNode(n))
	}

	return out
}
开发者ID:vinodpanicker,项目名称:swarm,代码行数:12,代码来源:cluster.go

示例2: listNodes

// listNodes returns all the nodess in the cluster.
func (c *Cluster) listNodes() []*node.Node {
	c.RLock()
	defer c.RUnlock()

	out := []*node.Node{}
	for _, s := range c.slaves {
		n := node.NewNode(s.engine)
		n.ID = s.id
		n.TotalCpus = int64(sumScalarResourceValue(s.offers, "cpus"))
		n.UsedCpus = 0
		n.TotalMemory = int64(sumScalarResourceValue(s.offers, "mem")) * 1024 * 1024
		n.UsedMemory = 0
		out = append(out, n)
	}
	return out
}
开发者ID:denverdino,项目名称:swarm-1,代码行数:17,代码来源:cluster.go

示例3: listNodes

// listNodes returns all validated engines in the cluster, excluding pendingEngines.
func (c *Cluster) listNodes() []*node.Node {
	c.RLock()
	defer c.RUnlock()

	out := make([]*node.Node, 0, len(c.engines))
	for _, e := range c.engines {
		node := node.NewNode(e)
		for _, c := range c.pendingContainers {
			if c.Engine.ID == e.ID && node.Container(c.Config.SwarmID()) == nil {
				node.AddContainer(c.ToContainer())
			}
		}
		out = append(out, node)
	}

	return out
}
开发者ID:kingsmiler,项目名称:swarm,代码行数:18,代码来源:cluster.go


注:本文中的github.com/docker/swarm/scheduler/node.NewNode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。