Class: LanGrove::Behaviour::Preloadable

Inherits:
LanGrove::Base show all
Defined in:
lib/langrove/behaviour/preloadable.rb

Instance Attribute Summary

Attributes inherited from LanGrove::Base

#logger

Instance Method Summary collapse

Methods inherited from LanGrove::Base

#config_exception, #type

Constructor Details

#initialize(root, config, name) ⇒ Preloadable

Returns a new instance of Preloadable.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/langrove/behaviour/preloadable.rb', line 9

def initialize( root, config, name )
  
  @requires = {
    
    :persistor => {
      
      :actions => [
        
        #
        # Generally for Multiplexing
        # 
        # ie. Loads all persisted handler.capsules
        #     into state ahead of going to listen 
        #     for updates on the aggregated stream
        #
        #     This solves 2 problems
        # 
        #     - The cost of collecting the capsule
        #       on the Just In Time (when the source 
        #       host's first message since daemon start
        #       arrives)
        # 
        #     - The hazard of not having the persis-
        #       tance DB/file accessable at the 
        #       time the capsule needs to be loaded.
        # 
        #       Effectively avoiding the near-unresolv-
        #       able calamity... 
        #
        #       "i cannot get previous state and now 
        #        i'm getting updates for it"
        #
        #
        #       ...by enforcing a preload and bringing
        #       down the daemon unless it succeeds.
        #
        :fetch_all
        
      ],
      
      :version => PRELOADABLE_VERSION
      
    }
    
  } if @requires.nil?
  
  super
  
end