Flatten converts the recursive etcd directory structure to a flat one that contains all kontrolNodes
()
| 31 | // Flatten converts the recursive etcd directory structure to a flat one that |
| 32 | // contains all kontrolNodes |
| 33 | func (n *Node) Flatten() []*Node { |
| 34 | nodes := make([]*Node, 0) |
| 35 | for _, node := range n.Node.Nodes { |
| 36 | if node.Dir { |
| 37 | nodes = append(nodes, NewNode(node).Flatten()...) |
| 38 | continue |
| 39 | } |
| 40 | |
| 41 | nodes = append(nodes, NewNode(node)) |
| 42 | } |
| 43 | |
| 44 | return nodes |
| 45 | } |
| 46 | |
| 47 | // Kite returns a single kite gathered from the key and the value for the |
| 48 | // current node. |