Class: Furnish::VM
- Inherits:
-
Object
- Object
- Furnish::VM
- Defined in:
- lib/furnish/vm.rb
Overview
This class mainly exists to track the run state of the Scheduler, and is kept simple. The attributes delegate to Palsy instances.
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
the dependencies that each vm group depends on.
-
#groups ⇒ Object
readonly
the vm groups and their provisioning lists.
-
#need_recovery ⇒ Object
readonly
the set of groups that need recovery, and the exceptions they threw (if any).
-
#solved ⇒ Object
readonly
the set of provisioned (solved) groups.
-
#waiters ⇒ Object
readonly
the set of groups waiting to be provisioned.
-
#working ⇒ Object
readonly
the set of provisioning (working) groups.
Instance Method Summary collapse
-
#initialize ⇒ VM
constructor
Create a new VM object.
-
#sync_waiters ⇒ Object
Helper to deal with waiters in a synchronous way.
Constructor Details
#initialize ⇒ VM
Create a new VM object. Should only happen in the Scheduler.
23 24 25 26 27 28 29 30 31 |
# File 'lib/furnish/vm.rb', line 23 def initialize @groups = Palsy::Map.new('vm_groups', 'provisioner_group') @dependencies = Palsy::Map.new('vm_groups', 'dependency_group') @need_recovery = Palsy::Map.new('vm_groups', 'need_recovery') @solved = Palsy::Set.new('vm_scheduler', 'provisioned') @working = Palsy::Set.new('vm_scheduler', 'working') @waiters = Palsy::Set.new('vm_scheduler', 'waiters') @waiters_mutex = Mutex.new end |
Instance Attribute Details
#dependencies ⇒ Object (readonly)
the dependencies that each vm group depends on
10 11 12 |
# File 'lib/furnish/vm.rb', line 10 def dependencies @dependencies end |
#groups ⇒ Object (readonly)
the vm groups and their provisioning lists.
8 9 10 |
# File 'lib/furnish/vm.rb', line 8 def groups @groups end |
#need_recovery ⇒ Object (readonly)
the set of groups that need recovery, and the exceptions they threw (if any)
18 19 20 |
# File 'lib/furnish/vm.rb', line 18 def need_recovery @need_recovery end |
#solved ⇒ Object (readonly)
the set of provisioned (solved) groups
12 13 14 |
# File 'lib/furnish/vm.rb', line 12 def solved @solved end |
#waiters ⇒ Object (readonly)
the set of groups waiting to be provisioned.
16 17 18 |
# File 'lib/furnish/vm.rb', line 16 def waiters @waiters end |
#working ⇒ Object (readonly)
the set of provisioning (working) groups
14 15 16 |
# File 'lib/furnish/vm.rb', line 14 def working @working end |
Instance Method Details
#sync_waiters ⇒ Object
Helper to deal with waiters in a synchronous way.
36 37 38 39 40 |
# File 'lib/furnish/vm.rb', line 36 def sync_waiters @waiters_mutex.synchronize do yield @waiters end end |