本文整理汇总了Golang中github.com/burke/zeus/go/processtree.SlaveNode类的典型用法代码示例。如果您正苦于以下问题:Golang SlaveNode类的具体用法?Golang SlaveNode怎么用?Golang SlaveNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SlaveNode类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: iteratePlan
func iteratePlan(tree *processtree.ProcessTree, plan map[string]interface{}, parent *processtree.SlaveNode) {
for name, v := range plan {
if subPlan, ok := v.(map[string]interface{}); ok {
newNode := tree.NewSlaveNode(name, parent)
if parent == nil {
tree.Root = newNode
} else {
parent.Slaves = append(parent.Slaves, newNode)
}
iteratePlan(tree, subPlan, newNode)
} else {
var newNode *processtree.CommandNode
if aliases, ok := v.([]interface{}); ok {
strs := make([]string, len(aliases))
for i, alias := range aliases {
strs[i] = alias.(string)
}
newNode = tree.NewCommandNode(name, strs, parent)
} else if v == nil {
newNode = tree.NewCommandNode(name, nil, parent)
} else {
zerror.ErrorConfigFileInvalidFormat()
}
parent.Commands = append(parent.Commands, newNode)
}
}
}
开发者ID:grosser,项目名称:zeus,代码行数:27,代码来源:config.go
示例2: drawSubtree
func (s *StatusChart) drawSubtree(node *processtree.SlaveNode, myIndentation, childIndentation string) {
printStateInfo(myIndentation, node.Name, node.State(), false, true)
for i, slave := range node.Slaves {
if i == len(node.Slaves)-1 {
s.drawSubtree(slave, childIndentation+lineL, childIndentation+lineX)
} else {
s.drawSubtree(slave, childIndentation+lineT, childIndentation+lineI)
}
}
}
开发者ID:burke,项目名称:zeus,代码行数:11,代码来源:tty.go
示例3: bootNewCommand
func bootNewCommand(slaveNode *processtree.SlaveNode, command string, err error) (*unixsocket.Usock, error) {
if err != nil {
return nil, err
}
request := &processtree.CommandRequest{command, make(chan *os.File)}
slaveNode.RequestCommandBoot(request)
commandFile := <-request.Retchan // TODO: don't really want to wait indefinitely.
// defer commandFile.Close() // TODO: can't do this here anymore.
return unixsocket.NewUsockFromFile(commandFile)
}
开发者ID:honkfestival,项目名称:zeus,代码行数:12,代码来源:clienthandler.go
示例4: bootNewCommand
func bootNewCommand(slaveNode *processtree.SlaveNode, command string, err error) (*unixsocket.Usock, error) {
if err != nil {
return nil, err
}
request := &processtree.CommandRequest{Name: command, Retchan: make(chan *processtree.CommandReply)}
slaveNode.RequestCommandBoot(request)
reply := <-request.Retchan // TODO: don't really want to wait indefinitely.
// defer commandFile.Close() // TODO: can't do this here anymore.
if reply.State == processtree.SCrashed {
return nil, errors.New("Process has crashed")
}
return unixsocket.NewFromFile(reply.File)
}
开发者ID:nevir,项目名称:zeus,代码行数:16,代码来源:clienthandler.go
示例5: logSubtree
func (s *StatusChart) logSubtree(node *processtree.SlaveNode) {
log := theChart.directLogger
printStateInfo("", node.Name, node.State(), true, false)
if len(node.Slaves) > 0 {
log.ColorizedSansNl("{reset}(")
}
for i, slave := range node.Slaves {
if i != 0 {
log.ColorizedSansNl("{reset}, ")
}
s.logSubtree(slave)
}
if len(node.Slaves) > 0 {
log.ColorizedSansNl("{reset})")
}
}
开发者ID:burke,项目名称:zeus,代码行数:17,代码来源:stdout.go
注:本文中的github.com/burke/zeus/go/processtree.SlaveNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论