Class: Syskit::NetworkGeneration::SystemNetworkDeployer::DeploymentGroupVisitor Private
- Inherits:
-
RGL::DFSVisitor
- Object
- RGL::DFSVisitor
- Syskit::NetworkGeneration::SystemNetworkDeployer::DeploymentGroupVisitor
- Defined in:
- lib/syskit/network_generation/system_network_deployer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A DFS visitor that propagates the deployment group attribute in the plan hierarchy
Instance Attribute Summary collapse
- #default_group ⇒ Object readonly private
- #deployment_groups ⇒ Object readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #handle_forward_edge(parent_task, child_task) ⇒ Object private
- #handle_start_vertex(root_task) ⇒ Object private
- #handle_tree_edge(parent_task, child_task) ⇒ Object private
-
#initialize(graph, default_group, use_cow: true) ⇒ DeploymentGroupVisitor
constructor
private
A new instance of DeploymentGroupVisitor.
- #propagate_deployment_group(parent_task, child_task) ⇒ Object private
- #use_cow? ⇒ Boolean private
Constructor Details
#initialize(graph, default_group, use_cow: true) ⇒ DeploymentGroupVisitor
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of DeploymentGroupVisitor
108 109 110 111 112 113 |
# File 'lib/syskit/network_generation/system_network_deployer.rb', line 108 def initialize(graph, default_group, use_cow: true) super(graph) @default_group = default_group @deployment_groups = Hash.new @use_cow = use_cow end |
Instance Attribute Details
#default_group ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
103 104 105 |
# File 'lib/syskit/network_generation/system_network_deployer.rb', line 103 def default_group @default_group end |
#deployment_groups ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
104 105 106 |
# File 'lib/syskit/network_generation/system_network_deployer.rb', line 104 def deployment_groups @deployment_groups end |
Class Method Details
.update_deployment_groups(deployment_groups, task, added_group, use_cow: true) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/syskit/network_generation/system_network_deployer.rb', line 132 def self.update_deployment_groups( deployment_groups, task, added_group, use_cow: true) shared, existing_group = deployment_groups[task] if existing_group if existing_group.eql?(added_group) return elsif shared existing_group = existing_group.dup end existing_group.use_group(added_group) deployment_groups[task] = [false, existing_group] elsif use_cow deployment_groups[task] = [true, added_group] else deployment_groups[task] = [false, added_group.dup] end end |
Instance Method Details
#handle_forward_edge(parent_task, child_task) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
180 181 182 |
# File 'lib/syskit/network_generation/system_network_deployer.rb', line 180 def handle_forward_edge(parent_task, child_task) propagate_deployment_group(parent_task, child_task) end |
#handle_start_vertex(root_task) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/syskit/network_generation/system_network_deployer.rb', line 115 def handle_start_vertex(root_task) return if !root_task.kind_of?(Syskit::Component) task_group = root_task.requirements.deployment_group group = if task_group.empty? default_group else task_group end deployment_groups[root_task] = if use_cow? [true, group] else [false, group.dup] end end |
#handle_tree_edge(parent_task, child_task) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
177 178 179 |
# File 'lib/syskit/network_generation/system_network_deployer.rb', line 177 def handle_tree_edge(parent_task, child_task) propagate_deployment_group(parent_task, child_task) end |
#propagate_deployment_group(parent_task, child_task) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/syskit/network_generation/system_network_deployer.rb', line 150 def propagate_deployment_group(parent_task, child_task) if !parent_task.kind_of?(Syskit::Component) if child_task.kind_of?(Syskit::Component) && !deployment_groups[child_task] handle_start_vertex(child_task) end return elsif !child_task.kind_of?(Syskit::Component) return end child_group = child_task.requirements.deployment_group if !child_group.empty? deployment_groups[child_task] = if use_cow? [true, child_group] else [false, child_group.dup] end else _, parent_group = deployment_groups[parent_task] DeploymentGroupVisitor.update_deployment_groups( deployment_groups, child_task, parent_group, use_cow: use_cow?) end end |
#use_cow? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
106 |
# File 'lib/syskit/network_generation/system_network_deployer.rb', line 106 attr_predicate :use_cow? |