boogaloo 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/CHANGELOG +2 -0
  2. data/DEBUGGING +4 -0
  3. data/MIT-LICENSE +7 -0
  4. data/README +106 -0
  5. data/RUNNING_UNIT_TESTS +5 -0
  6. data/Rakefile +44 -0
  7. data/bin/boogaloo +159 -0
  8. data/doc/classes/Boogaloo.html +149 -0
  9. data/doc/classes/Boogaloo/Cache.html +121 -0
  10. data/doc/classes/Boogaloo/Cache/Base.html +664 -0
  11. data/doc/classes/Boogaloo/Cache/Persistent.html +122 -0
  12. data/doc/classes/Boogaloo/Cache/Temporary.html +439 -0
  13. data/doc/classes/Boogaloo/Client.html +111 -0
  14. data/doc/classes/Boogaloo/Client/Connection.html +228 -0
  15. data/doc/classes/Boogaloo/Config.html +540 -0
  16. data/doc/classes/Boogaloo/ServiceGateway.html +176 -0
  17. data/doc/classes/Boogaloo/ServiceRequest.html +210 -0
  18. data/doc/classes/Boogaloo/ThreadPool.html +205 -0
  19. data/doc/classes/Boogaloo/WorkerThread.html +239 -0
  20. data/doc/created.rid +1 -0
  21. data/doc/files/DEBUGGING.html +113 -0
  22. data/doc/files/MIT-LICENSE.html +129 -0
  23. data/doc/files/README.html +261 -0
  24. data/doc/files/examples/boogaloo_conf.html +130 -0
  25. data/doc/files/lib/boogaloo/cache/base_rb.html +101 -0
  26. data/doc/files/lib/boogaloo/cache/persistent_rb.html +108 -0
  27. data/doc/files/lib/boogaloo/cache/temporary_rb.html +101 -0
  28. data/doc/files/lib/boogaloo/client/connection_rb.html +101 -0
  29. data/doc/files/lib/boogaloo/config_rb.html +109 -0
  30. data/doc/files/lib/boogaloo/service_gateway_rb.html +110 -0
  31. data/doc/files/lib/boogaloo/service_request_rb.html +108 -0
  32. data/doc/files/lib/boogaloo/thread_pool_rb.html +101 -0
  33. data/doc/files/lib/boogaloo/util_rb.html +240 -0
  34. data/doc/files/lib/boogaloo/version_rb.html +114 -0
  35. data/doc/files/lib/boogaloo/worker_thread_rb.html +101 -0
  36. data/doc/fr_class_index.html +38 -0
  37. data/doc/fr_file_index.html +41 -0
  38. data/doc/fr_method_index.html +67 -0
  39. data/doc/index.html +24 -0
  40. data/doc/rdoc-style.css +208 -0
  41. data/examples/boogaloo.conf +17 -0
  42. data/lib/boogaloo/cache/base.rb +222 -0
  43. data/lib/boogaloo/cache/persistent.rb +15 -0
  44. data/lib/boogaloo/cache/temporary.rb +173 -0
  45. data/lib/boogaloo/client/connection.rb +55 -0
  46. data/lib/boogaloo/config.rb +206 -0
  47. data/lib/boogaloo/service_gateway.rb +37 -0
  48. data/lib/boogaloo/service_request.rb +39 -0
  49. data/lib/boogaloo/thread_pool.rb +40 -0
  50. data/lib/boogaloo/util.rb +29 -0
  51. data/lib/boogaloo/version.rb +1 -0
  52. data/lib/boogaloo/worker_thread.rb +46 -0
  53. data/test/test_persistent_cache.rb +99 -0
  54. data/test/test_service_gateway.rb +27 -0
  55. data/test/test_synchronicity.rb +29 -0
  56. data/test/test_temporary_cache.rb +42 -0
  57. metadata +113 -0
@@ -0,0 +1,111 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Boogaloo::Client</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Boogaloo::Client</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/boogaloo/client/connection_rb.html">
59
+ lib/boogaloo/client/connection.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+
80
+ </div>
81
+
82
+
83
+ <!-- if includes -->
84
+
85
+ <div id="section">
86
+
87
+ <div id="class-list">
88
+ <h3 class="section-bar">Classes and Modules</h3>
89
+
90
+ Class <a href="Client/Connection.html" class="link">Boogaloo::Client::Connection</a><br />
91
+
92
+ </div>
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <!-- if method_list -->
101
+
102
+
103
+ </div>
104
+
105
+
106
+ <div id="validator-badges">
107
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
108
+ </div>
109
+
110
+ </body>
111
+ </html>
@@ -0,0 +1,228 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Boogaloo::Client::Connection</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Boogaloo::Client::Connection</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/boogaloo/client/connection_rb.html">
59
+ lib/boogaloo/client/connection.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ A wrapper around DRb for connecting to the boogaloo server.
84
+ </p>
85
+ <p>
86
+ Example usage:
87
+ </p>
88
+ <pre>
89
+ boogaloo_cache = Boogaloo::Client::Connection.new('localhost', 7777, true)
90
+ </pre>
91
+
92
+ </div>
93
+
94
+
95
+ </div>
96
+
97
+ <div id="method-list">
98
+ <h3 class="section-bar">Methods</h3>
99
+
100
+ <div class="name-list">
101
+ <a href="#M000006">method_missing</a>&nbsp;&nbsp;
102
+ <a href="#M000005">new</a>&nbsp;&nbsp;
103
+ </div>
104
+ </div>
105
+
106
+ </div>
107
+
108
+
109
+ <!-- if includes -->
110
+
111
+ <div id="section">
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+ <!-- if method_list -->
121
+ <div id="methods">
122
+ <h3 class="section-bar">Public Class methods</h3>
123
+
124
+ <div id="method-M000005" class="method-detail">
125
+ <a name="M000005"></a>
126
+
127
+ <div class="method-heading">
128
+ <a href="#M000005" class="method-signature">
129
+ <span class="method-name">new</span><span class="method-args">(host, port, wrap=false)</span>
130
+ </a>
131
+ </div>
132
+
133
+ <div class="method-description">
134
+ <p>
135
+ Create a new connection to the boogaloo server.
136
+ </p>
137
+ <p>
138
+ Parameters:
139
+ </p>
140
+ <table>
141
+ <tr><td valign="top"><tt>host</tt>:</td><td>The host name or IP address to bind the socket to.
142
+
143
+ </td></tr>
144
+ <tr><td valign="top"><tt>port</tt>:</td><td>The port to bind the socket to.
145
+
146
+ </td></tr>
147
+ <tr><td valign="top"><tt>wrap</tt>:</td><td>If true, attempts to access the server when it is offline will result in a
148
+ <em>nil</em> being returned instead of an exception being raised.
149
+
150
+ </td></tr>
151
+ </table>
152
+ <p><a class="source-toggle" href="#"
153
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
154
+ <div class="method-source-code" id="M000005-source">
155
+ <pre>
156
+ <span class="ruby-comment cmt"># File lib/boogaloo/client/connection.rb, line 19</span>
157
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">wrap</span>=<span class="ruby-keyword kw">false</span>)
158
+
159
+ <span class="ruby-ivar">@wrap</span> = <span class="ruby-identifier">wrap</span>
160
+ <span class="ruby-identifier">druby_str</span> = <span class="ruby-node">&quot;druby://#{host}:#{port}&quot;</span>
161
+ <span class="ruby-constant">DRb</span>.<span class="ruby-identifier">start_service</span>
162
+ <span class="ruby-ivar">@conn</span> = <span class="ruby-constant">DRbObject</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">druby_str</span>)
163
+
164
+ <span class="ruby-keyword kw">end</span>
165
+ </pre>
166
+ </div>
167
+ </div>
168
+ </div>
169
+
170
+ <h3 class="section-bar">Public Instance methods</h3>
171
+
172
+ <div id="method-M000006" class="method-detail">
173
+ <a name="M000006"></a>
174
+
175
+ <div class="method-heading">
176
+ <a href="#M000006" class="method-signature">
177
+ <span class="method-name">method_missing</span><span class="method-args">(msg_id, *a, &amp;b)</span>
178
+ </a>
179
+ </div>
180
+
181
+ <div class="method-description">
182
+ <p>
183
+ Forwards all method calls to the server.
184
+ </p>
185
+ <p><a class="source-toggle" href="#"
186
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
187
+ <div class="method-source-code" id="M000006-source">
188
+ <pre>
189
+ <span class="ruby-comment cmt"># File lib/boogaloo/client/connection.rb, line 29</span>
190
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">msg_id</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)
191
+
192
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@wrap</span>
193
+
194
+ <span class="ruby-keyword kw">begin</span>
195
+
196
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@conn</span>.<span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">msg_id</span>, <span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>)
197
+
198
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">DRb</span><span class="ruby-operator">::</span><span class="ruby-constant">DRbConnError</span>
199
+
200
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
201
+
202
+ <span class="ruby-keyword kw">end</span>
203
+
204
+ <span class="ruby-keyword kw">else</span>
205
+
206
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@conn</span>.<span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">msg_id</span>, <span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span>)
207
+
208
+ <span class="ruby-keyword kw">end</span>
209
+
210
+ <span class="ruby-keyword kw">end</span>
211
+ </pre>
212
+ </div>
213
+ </div>
214
+ </div>
215
+
216
+
217
+ </div>
218
+
219
+
220
+ </div>
221
+
222
+
223
+ <div id="validator-badges">
224
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
225
+ </div>
226
+
227
+ </body>
228
+ </html>
@@ -0,0 +1,540 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Boogaloo::Config</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Boogaloo::Config</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/boogaloo/config_rb.html">
59
+ lib/boogaloo/config.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ See <a
84
+ href="../../files/examples/boogaloo_conf.html">examples/boogalooo.conf</a>
85
+ for an example configuration file.
86
+ </p>
87
+ <h1>Available Configuration Options</h1>
88
+ <h2>Section: Server</h2>
89
+ <table>
90
+ <tr><td valign="top"><tt>host</tt>:</td><td>(required) The host name or IP address to bind the socket to.
91
+
92
+ </td></tr>
93
+ <tr><td valign="top"><tt>port</tt>:</td><td>(required) The port to bind the socket to.
94
+
95
+ </td></tr>
96
+ <tr><td valign="top"><tt>worker_threads</tt>:</td><td>(required) <a href="../Boogaloo.html">Boogaloo</a> uses a pool of threads
97
+ created at start-up that wait for requests to handle. 3 is a reasonable
98
+ default.
99
+
100
+ </td></tr>
101
+ <tr><td valign="top"><tt>debug</tt>:</td><td>(optional) Enable/disable debugging. See <a
102
+ href="../../files/DEBUGGING.html">DEBUGGING</a> for for information.
103
+
104
+ </td></tr>
105
+ </table>
106
+ <h2>Section: PersistentCaches</h2>
107
+ <table>
108
+ <tr><td valign="top"><tt>instance_name</tt>:</td><td>(required) The name to use for accessing the cache on the client.
109
+
110
+ </td></tr>
111
+ </table>
112
+ <p>
113
+ Example:
114
+ </p>
115
+ <pre>
116
+ PersistentCaches:
117
+
118
+ MyPersistentCache:
119
+ instance_name: main_cache
120
+ </pre>
121
+ <h2>Section: TemporaryCaches</h2>
122
+ <table>
123
+ <tr><td valign="top"><tt>instance_name</tt>:</td><td>(required) The name to use for accessing the cache on the client.
124
+
125
+ </td></tr>
126
+ <tr><td valign="top"><tt>check_frequency</tt>:</td><td>(required) The frequency in seconds at which the cache will check for
127
+ expired objects to delete.
128
+
129
+ </td></tr>
130
+ </table>
131
+ <p>
132
+ Example:
133
+ </p>
134
+ <pre>
135
+ TemporaryCaches:
136
+
137
+ MyTempCache:
138
+ instance_name: temp_cache
139
+ check_frequency: 10
140
+ </pre>
141
+ <h2>Section: Services</h2>
142
+ <table>
143
+ <tr><td valign="top"><tt>instance_name</tt>:</td><td>(required) The name to use for accessing the service on the client.
144
+
145
+ </td></tr>
146
+ <tr><td valign="top"><tt>path</tt>:</td><td>(required) The path to the directory containing your interface.rb file.
147
+
148
+ </td></tr>
149
+ <tr><td valign="top"><tt>parameters</tt>:</td><td>(optional) If your interface constructor accepts parameters you can specify
150
+ them hear.
151
+
152
+ </td></tr>
153
+ <tr><td valign="top"><tt>require_path</tt>:</td><td>(optional) If your service needs to require files not in the standard
154
+ $LOAD_PATH, you can specify directories to add to the $LOAD_PATH here
155
+ either as a list or in singular form.
156
+
157
+ </td></tr>
158
+ </table>
159
+ <p>
160
+ Example:
161
+ </p>
162
+ <pre>
163
+ Services:
164
+
165
+ MyService:
166
+ instance_name: my_service
167
+ path: /home/me/BoogalooServices/MyService
168
+ parameters:
169
+ - Hello
170
+ - World
171
+ require_path:
172
+ - /some/dir
173
+ - /some/other/dir
174
+ </pre>
175
+
176
+ </div>
177
+
178
+
179
+ </div>
180
+
181
+ <div id="method-list">
182
+ <h3 class="section-bar">Methods</h3>
183
+
184
+ <div class="name-list">
185
+ <a href="#M000029">new</a>&nbsp;&nbsp;
186
+ <a href="#M000034">persistent_caches</a>&nbsp;&nbsp;
187
+ <a href="#M000030">server</a>&nbsp;&nbsp;
188
+ <a href="#M000031">server_host</a>&nbsp;&nbsp;
189
+ <a href="#M000032">server_port</a>&nbsp;&nbsp;
190
+ <a href="#M000033">server_worker_threads</a>&nbsp;&nbsp;
191
+ <a href="#M000036">services</a>&nbsp;&nbsp;
192
+ <a href="#M000035">temporary_caches</a>&nbsp;&nbsp;
193
+ </div>
194
+ </div>
195
+
196
+ </div>
197
+
198
+
199
+ <!-- if includes -->
200
+
201
+ <div id="section">
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+ <!-- if method_list -->
211
+ <div id="methods">
212
+ <h3 class="section-bar">Public Class methods</h3>
213
+
214
+ <div id="method-M000029" class="method-detail">
215
+ <a name="M000029"></a>
216
+
217
+ <div class="method-heading">
218
+ <a href="#M000029" class="method-signature">
219
+ <span class="method-name">new</span><span class="method-args">(file)</span>
220
+ </a>
221
+ </div>
222
+
223
+ <div class="method-description">
224
+ <p>
225
+ Initialize a new cofig instance.
226
+ </p>
227
+ <p>
228
+ Parameters:
229
+ </p>
230
+ <table>
231
+ <tr><td valign="top"><tt>file</tt>:</td><td>The configuration file to read.
232
+
233
+ </td></tr>
234
+ </table>
235
+ <p><a class="source-toggle" href="#"
236
+ onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
237
+ <div class="method-source-code" id="M000029-source">
238
+ <pre>
239
+ <span class="ruby-comment cmt"># File lib/boogaloo/config.rb, line 69</span>
240
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">file</span>)
241
+
242
+ <span class="ruby-ivar">@config</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>)
243
+ <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;Server configuration not found.&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'Server'</span>)
244
+ <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;host attribute missing for Server configuration.&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'Server'</span>].<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'host'</span>)
245
+ <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;port attribute missing for Server configuration.&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'Server'</span>].<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'port'</span>)
246
+ <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;worker_threads attribute missing for Server configuration.&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'Server'</span>].<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'worker_threads'</span>)
247
+
248
+ <span class="ruby-ivar">@persistent_caches</span> = {}
249
+ <span class="ruby-ivar">@temporary_caches</span> = {}
250
+ <span class="ruby-ivar">@services</span> = {}
251
+
252
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'PersistentCaches'</span>]
253
+
254
+ <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'PersistentCaches'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">config</span><span class="ruby-operator">|</span>
255
+
256
+ <span class="ruby-identifier">error</span> <span class="ruby-value str">&quot;name attribute missing for persistent cache.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">name</span> <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
257
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;configration missing for persistent cache '#{name}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
258
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;instance_name attribute missing for persistent cache '#{name}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'instance_name'</span>)
259
+
260
+ <span class="ruby-identifier">conflict</span> = <span class="ruby-keyword kw">nil</span>
261
+ <span class="ruby-ivar">@persistent_caches</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">conflict</span> = <span class="ruby-identifier">key</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-value str">'instance_name'</span>].<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">config</span>[<span class="ruby-value str">'instance_name'</span>])}
262
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;instance name '#{config['instance_name']}' for '#{name}' conflicts with persistent cache '#{conflict}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conflict</span>
263
+
264
+ <span class="ruby-ivar">@persistent_caches</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">config</span>
265
+
266
+ <span class="ruby-keyword kw">end</span>
267
+
268
+ <span class="ruby-keyword kw">end</span>
269
+
270
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'TemporaryCaches'</span>]
271
+
272
+ <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'TemporaryCaches'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">config</span><span class="ruby-operator">|</span>
273
+
274
+ <span class="ruby-identifier">error</span> <span class="ruby-value str">&quot;name attribute missing for temporary cache.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">name</span> <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
275
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;configration missing for temporary cache '#{name}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
276
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;instance_name attribute missing for temporary cache '#{name}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'instance_name'</span>)
277
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;check_frequency attribute missing for temporary cache '#{name}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'check_frequency'</span>)
278
+
279
+ <span class="ruby-identifier">conflict</span> = <span class="ruby-keyword kw">nil</span>
280
+ <span class="ruby-ivar">@temporary_caches</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">conflict</span> = <span class="ruby-identifier">key</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-value str">'instance_name'</span>].<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">config</span>[<span class="ruby-value str">'instance_name'</span>])}
281
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;instance name '#{config['instance_name']}' for '#{name}' conflicts with temporary cache '#{conflict}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conflict</span>
282
+
283
+ <span class="ruby-ivar">@persistent_caches</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">conflict</span> = <span class="ruby-identifier">key</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-value str">'instance_name'</span>].<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">config</span>[<span class="ruby-value str">'instance_name'</span>])}
284
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;instance name '#{config['instance_name']}' for '#{name}' conflicts with persistent cache '#{conflict}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conflict</span>
285
+
286
+ <span class="ruby-ivar">@temporary_caches</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">config</span>
287
+
288
+ <span class="ruby-keyword kw">end</span>
289
+
290
+ <span class="ruby-keyword kw">end</span>
291
+
292
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'Services'</span>]
293
+
294
+ <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'Services'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">config</span><span class="ruby-operator">|</span>
295
+
296
+ <span class="ruby-identifier">error</span> <span class="ruby-value str">&quot;name attribute missing for service.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">name</span> <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
297
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;configration missing for service cache '#{name}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
298
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;path attribute missing for service '#{name}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'path'</span>)
299
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;instance_name attribute missing for service '#{name}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'instance_name'</span>)
300
+
301
+ <span class="ruby-identifier">conflict</span> = <span class="ruby-keyword kw">nil</span>
302
+ <span class="ruby-ivar">@services</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">conflict</span> = <span class="ruby-identifier">key</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-value str">'instance_name'</span>].<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">config</span>[<span class="ruby-value str">'instance_name'</span>])}
303
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;instance name '#{config['instance_name']}' for '#{name}' conflicts with service '#{conflict}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conflict</span>
304
+
305
+ <span class="ruby-ivar">@temporary_caches</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">conflict</span> = <span class="ruby-identifier">key</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-value str">'instance_name'</span>].<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">config</span>[<span class="ruby-value str">'instance_name'</span>])}
306
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;instance name '#{config['instance_name']}' for '#{name}' conflicts with temporary cache '#{conflict}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conflict</span>
307
+
308
+ <span class="ruby-ivar">@persistent_caches</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">conflict</span> = <span class="ruby-identifier">key</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>[<span class="ruby-value str">'instance_name'</span>].<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">config</span>[<span class="ruby-value str">'instance_name'</span>])}
309
+ <span class="ruby-identifier">error</span> <span class="ruby-node">&quot;instance name '#{config['instance_name']}' for '#{name}' conflicts with persistent cache '#{conflict}'.&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conflict</span>
310
+
311
+ <span class="ruby-ivar">@services</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">config</span>
312
+
313
+ <span class="ruby-keyword kw">end</span>
314
+
315
+ <span class="ruby-keyword kw">end</span>
316
+
317
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'Server'</span>][<span class="ruby-value str">'debug'</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span>
318
+
319
+ <span class="ruby-identifier">$debug</span> = <span class="ruby-keyword kw">true</span>
320
+ <span class="ruby-identifier">notice</span>(<span class="ruby-value str">&quot;Debugging enabled&quot;</span>)
321
+
322
+ <span class="ruby-keyword kw">end</span>
323
+
324
+ <span class="ruby-keyword kw">end</span>
325
+ </pre>
326
+ </div>
327
+ </div>
328
+ </div>
329
+
330
+ <h3 class="section-bar">Public Instance methods</h3>
331
+
332
+ <div id="method-M000034" class="method-detail">
333
+ <a name="M000034"></a>
334
+
335
+ <div class="method-heading">
336
+ <a href="#M000034" class="method-signature">
337
+ <span class="method-name">persistent_caches</span><span class="method-args">()</span>
338
+ </a>
339
+ </div>
340
+
341
+ <div class="method-description">
342
+ <p>
343
+ The entire <em>PersistentCaches</em> configuration section.
344
+ </p>
345
+ <p><a class="source-toggle" href="#"
346
+ onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
347
+ <div class="method-source-code" id="M000034-source">
348
+ <pre>
349
+ <span class="ruby-comment cmt"># File lib/boogaloo/config.rb, line 184</span>
350
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">persistent_caches</span>
351
+
352
+ <span class="ruby-ivar">@persistent_caches</span>
353
+
354
+ <span class="ruby-keyword kw">end</span>
355
+ </pre>
356
+ </div>
357
+ </div>
358
+ </div>
359
+
360
+ <div id="method-M000030" class="method-detail">
361
+ <a name="M000030"></a>
362
+
363
+ <div class="method-heading">
364
+ <a href="#M000030" class="method-signature">
365
+ <span class="method-name">server</span><span class="method-args">()</span>
366
+ </a>
367
+ </div>
368
+
369
+ <div class="method-description">
370
+ <p>
371
+ The entire <em>Server</em> configuration section.
372
+ </p>
373
+ <p><a class="source-toggle" href="#"
374
+ onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
375
+ <div class="method-source-code" id="M000030-source">
376
+ <pre>
377
+ <span class="ruby-comment cmt"># File lib/boogaloo/config.rb, line 156</span>
378
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server</span>
379
+
380
+ <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'Server'</span>]
381
+
382
+ <span class="ruby-keyword kw">end</span>
383
+ </pre>
384
+ </div>
385
+ </div>
386
+ </div>
387
+
388
+ <div id="method-M000031" class="method-detail">
389
+ <a name="M000031"></a>
390
+
391
+ <div class="method-heading">
392
+ <a href="#M000031" class="method-signature">
393
+ <span class="method-name">server_host</span><span class="method-args">()</span>
394
+ </a>
395
+ </div>
396
+
397
+ <div class="method-description">
398
+ <p>
399
+ The server host.
400
+ </p>
401
+ <p><a class="source-toggle" href="#"
402
+ onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
403
+ <div class="method-source-code" id="M000031-source">
404
+ <pre>
405
+ <span class="ruby-comment cmt"># File lib/boogaloo/config.rb, line 163</span>
406
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server_host</span>
407
+
408
+ <span class="ruby-identifier">server</span>[<span class="ruby-value str">'host'</span>]
409
+
410
+ <span class="ruby-keyword kw">end</span>
411
+ </pre>
412
+ </div>
413
+ </div>
414
+ </div>
415
+
416
+ <div id="method-M000032" class="method-detail">
417
+ <a name="M000032"></a>
418
+
419
+ <div class="method-heading">
420
+ <a href="#M000032" class="method-signature">
421
+ <span class="method-name">server_port</span><span class="method-args">()</span>
422
+ </a>
423
+ </div>
424
+
425
+ <div class="method-description">
426
+ <p>
427
+ The server port.
428
+ </p>
429
+ <p><a class="source-toggle" href="#"
430
+ onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
431
+ <div class="method-source-code" id="M000032-source">
432
+ <pre>
433
+ <span class="ruby-comment cmt"># File lib/boogaloo/config.rb, line 170</span>
434
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server_port</span>
435
+
436
+ <span class="ruby-identifier">server</span>[<span class="ruby-value str">'port'</span>]
437
+
438
+ <span class="ruby-keyword kw">end</span>
439
+ </pre>
440
+ </div>
441
+ </div>
442
+ </div>
443
+
444
+ <div id="method-M000033" class="method-detail">
445
+ <a name="M000033"></a>
446
+
447
+ <div class="method-heading">
448
+ <a href="#M000033" class="method-signature">
449
+ <span class="method-name">server_worker_threads</span><span class="method-args">()</span>
450
+ </a>
451
+ </div>
452
+
453
+ <div class="method-description">
454
+ <p>
455
+ The number of worker threads.
456
+ </p>
457
+ <p><a class="source-toggle" href="#"
458
+ onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
459
+ <div class="method-source-code" id="M000033-source">
460
+ <pre>
461
+ <span class="ruby-comment cmt"># File lib/boogaloo/config.rb, line 177</span>
462
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">server_worker_threads</span>
463
+
464
+ <span class="ruby-identifier">server</span>[<span class="ruby-value str">'worker_threads'</span>]
465
+
466
+ <span class="ruby-keyword kw">end</span>
467
+ </pre>
468
+ </div>
469
+ </div>
470
+ </div>
471
+
472
+ <div id="method-M000036" class="method-detail">
473
+ <a name="M000036"></a>
474
+
475
+ <div class="method-heading">
476
+ <a href="#M000036" class="method-signature">
477
+ <span class="method-name">services</span><span class="method-args">()</span>
478
+ </a>
479
+ </div>
480
+
481
+ <div class="method-description">
482
+ <p>
483
+ The entire <em>Services</em> configuration section.
484
+ </p>
485
+ <p><a class="source-toggle" href="#"
486
+ onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
487
+ <div class="method-source-code" id="M000036-source">
488
+ <pre>
489
+ <span class="ruby-comment cmt"># File lib/boogaloo/config.rb, line 198</span>
490
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">services</span>
491
+
492
+ <span class="ruby-ivar">@services</span>
493
+
494
+ <span class="ruby-keyword kw">end</span>
495
+ </pre>
496
+ </div>
497
+ </div>
498
+ </div>
499
+
500
+ <div id="method-M000035" class="method-detail">
501
+ <a name="M000035"></a>
502
+
503
+ <div class="method-heading">
504
+ <a href="#M000035" class="method-signature">
505
+ <span class="method-name">temporary_caches</span><span class="method-args">()</span>
506
+ </a>
507
+ </div>
508
+
509
+ <div class="method-description">
510
+ <p>
511
+ The entire <em>TemporaryCaches</em> configuration section.
512
+ </p>
513
+ <p><a class="source-toggle" href="#"
514
+ onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
515
+ <div class="method-source-code" id="M000035-source">
516
+ <pre>
517
+ <span class="ruby-comment cmt"># File lib/boogaloo/config.rb, line 191</span>
518
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">temporary_caches</span>
519
+
520
+ <span class="ruby-ivar">@temporary_caches</span>
521
+
522
+ <span class="ruby-keyword kw">end</span>
523
+ </pre>
524
+ </div>
525
+ </div>
526
+ </div>
527
+
528
+
529
+ </div>
530
+
531
+
532
+ </div>
533
+
534
+
535
+ <div id="validator-badges">
536
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
537
+ </div>
538
+
539
+ </body>
540
+ </html>