SubScope returns a new Scope which will cause all operations added to the graph to be namespaced with 'namespace'. If namespace collides with an existing namespace within the scope, then a suffix will be added.
(namespace string)
| 95 | // graph to be namespaced with 'namespace'. If namespace collides with an |
| 96 | // existing namespace within the scope, then a suffix will be added. |
| 97 | func (s *Scope) SubScope(namespace string) *Scope { |
| 98 | namespace = s.uniqueName(namespace) |
| 99 | if s.namespace != "" { |
| 100 | namespace = s.namespace + "/" + namespace |
| 101 | } |
| 102 | return &Scope{ |
| 103 | graph: s.graph, |
| 104 | namemap: make(map[string]int), |
| 105 | namespace: namespace, |
| 106 | controlDependencies: s.controlDependencies, |
| 107 | device: s.device, |
| 108 | err: s.err, |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | // WithControlDependencies returns a new Scope which will cause all operations |
| 113 | // added to the graph to execute only after all the provided operations have |