Class: DopCommon::PlanCache
- Inherits:
-
Object
- Object
- DopCommon::PlanCache
- Defined in:
- lib/dop_common/plan_cache.rb
Instance Method Summary collapse
-
#initialize(plan_store) ⇒ PlanCache
constructor
A new instance of PlanCache.
-
#plan_by_node(node_name) ⇒ Object
will return the plan of the node or nil if the node is not in a plan.
Constructor Details
#initialize(plan_store) ⇒ PlanCache
Returns a new instance of PlanCache.
5 6 7 8 9 10 |
# File 'lib/dop_common/plan_cache.rb', line 5 def initialize(plan_store) @plan_store = plan_store @plans = {} # { plan_name => plan } @versions = {} # { plan => version } @nodes = {} # { node_name => plan } end |
Instance Method Details
#plan_by_node(node_name) ⇒ Object
will return the plan of the node or nil if the node is not in a plan
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dop_common/plan_cache.rb', line 14 def plan_by_node(node_name) plan = @nodes[node_name] if plan refresh_plan(plan) # this makes sure the node was not removed plan = @nodes[node_name] return plan if plan end refresh_all return @nodes[node_name] end |