Class: Furnish::VM

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeVM

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

#dependenciesObject (readonly)

the dependencies that each vm group depends on



10
11
12
# File 'lib/furnish/vm.rb', line 10

def dependencies
  @dependencies
end

#groupsObject (readonly)

the vm groups and their provisioning lists.



8
9
10
# File 'lib/furnish/vm.rb', line 8

def groups
  @groups
end

#need_recoveryObject (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

#solvedObject (readonly)

the set of provisioned (solved) groups



12
13
14
# File 'lib/furnish/vm.rb', line 12

def solved
  @solved
end

#waitersObject (readonly)

the set of groups waiting to be provisioned.



16
17
18
# File 'lib/furnish/vm.rb', line 16

def waiters
  @waiters
end

#workingObject (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_waitersObject

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