~cgb-cs/appscale/appscale-main

« back to all changes in this revision

Viewing changes to AppController/doc/ZKInterface.html

  • Committer: Chris Bunch
  • Date: 2012-02-18 06:15:47 UTC
  • Revision ID: cgb@cs.ucsb.edu-20120218061547-8dg3gyqkiwzorqwh
adding rdoc generation and initial docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 
3
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<head>
 
6
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
 
7
 
 
8
  <title>Class: ZKInterface</title>
 
9
 
 
10
  <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
 
11
 
 
12
  <script src="./js/jquery.js" type="text/javascript"
 
13
    charset="utf-8"></script>
 
14
  <script src="./js/thickbox-compressed.js" type="text/javascript"
 
15
    charset="utf-8"></script>
 
16
  <script src="./js/quicksearch.js" type="text/javascript"
 
17
    charset="utf-8"></script>
 
18
  <script src="./js/darkfish.js" type="text/javascript"
 
19
    charset="utf-8"></script>
 
20
 
 
21
</head>
 
22
<body class="class">
 
23
 
 
24
  <div id="metadata">
 
25
    <div id="home-metadata">
 
26
      <div id="home-section" class="section">
 
27
        <h3 class="section-header">
 
28
          <a href="./index.html">Home</a>
 
29
          <a href="./index.html#classes">Classes</a>
 
30
          <a href="./index.html#methods">Methods</a>
 
31
        </h3>
 
32
      </div>
 
33
    </div>
 
34
 
 
35
    <div id="file-metadata">
 
36
      <div id="file-list-section" class="section">
 
37
        <h3 class="section-header">In Files</h3>
 
38
        <div class="section-body">
 
39
          <ul>
 
40
          
 
41
            <li><a href="./lib/zkinterface_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
 
42
              class="thickbox" title="lib/zkinterface.rb">lib/zkinterface.rb</a></li>
 
43
          
 
44
          </ul>
 
45
        </div>
 
46
      </div>
 
47
 
 
48
      
 
49
    </div>
 
50
 
 
51
    <div id="class-metadata">
 
52
 
 
53
      <!-- Parent Class -->
 
54
      
 
55
      <div id="parent-class-section" class="section">
 
56
        <h3 class="section-header">Parent</h3>
 
57
        
 
58
        <p class="link"><a href="Object.html">Object</a></p>
 
59
        
 
60
      </div>
 
61
      
 
62
 
 
63
      <!-- Namespace Contents -->
 
64
      
 
65
 
 
66
      <!-- Method Quickref -->
 
67
      
 
68
      <div id="method-list-section" class="section">
 
69
        <h3 class="section-header">Methods</h3>
 
70
        <ul class="link-list">
 
71
          
 
72
          <li><a href="#method-c-add_app_entry">::add_app_entry</a></li>
 
73
          
 
74
          <li><a href="#method-c-get_app_hosters">::get_app_hosters</a></li>
 
75
          
 
76
          <li><a href="#method-c-init">::init</a></li>
 
77
          
 
78
          <li><a href="#method-c-remove_app_entry">::remove_app_entry</a></li>
 
79
          
 
80
        </ul>
 
81
      </div>
 
82
      
 
83
 
 
84
      <!-- Included Modules -->
 
85
      
 
86
    </div>
 
87
 
 
88
    <div id="project-metadata">
 
89
      
 
90
      
 
91
 
 
92
      <div id="classindex-section" class="section project-section">
 
93
        <h3 class="section-header">Class/Module Index
 
94
          <span class="search-toggle"><img src="./images/find.png"
 
95
            height="16" width="16" alt="[+]"
 
96
            title="show/hide quicksearch" /></span></h3>
 
97
        <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
 
98
        <fieldset>
 
99
          <legend>Quicksearch</legend>
 
100
          <input type="text" name="quicksearch" value=""
 
101
            class="quicksearch-field" />
 
102
        </fieldset>
 
103
        </form>
 
104
 
 
105
        <ul class="link-list">
 
106
        
 
107
          <li><a href="./AppControllerClient.html">AppControllerClient</a></li>
 
108
        
 
109
          <li><a href="./BlobServer.html">BlobServer</a></li>
 
110
        
 
111
          <li><a href="./Collectd.html">Collectd</a></li>
 
112
        
 
113
          <li><a href="./CronHelper.html">CronHelper</a></li>
 
114
        
 
115
          <li><a href="./Djinn.html">Djinn</a></li>
 
116
        
 
117
          <li><a href="./DjinnJobData.html">DjinnJobData</a></li>
 
118
        
 
119
          <li><a href="./DjinnServer.html">DjinnServer</a></li>
 
120
        
 
121
          <li><a href="./Ejabberd.html">Ejabberd</a></li>
 
122
        
 
123
          <li><a href="./GodInterface.html">GodInterface</a></li>
 
124
        
 
125
          <li><a href="./HAProxy.html">HAProxy</a></li>
 
126
        
 
127
          <li><a href="./HelperFunctions.html">HelperFunctions</a></li>
 
128
        
 
129
          <li><a href="./JSONClient.html">JSONClient</a></li>
 
130
        
 
131
          <li><a href="./LoadBalancer.html">LoadBalancer</a></li>
 
132
        
 
133
          <li><a href="./Monitoring.html">Monitoring</a></li>
 
134
        
 
135
          <li><a href="./Nginx.html">Nginx</a></li>
 
136
        
 
137
          <li><a href="./Object.html">Object</a></li>
 
138
        
 
139
          <li><a href="./PbServer.html">PbServer</a></li>
 
140
        
 
141
          <li><a href="./RabbitMQ.html">RabbitMQ</a></li>
 
142
        
 
143
          <li><a href="./Repo.html">Repo</a></li>
 
144
        
 
145
          <li><a href="./UserAppClient.html">UserAppClient</a></li>
 
146
        
 
147
          <li><a href="./ZKInterface.html">ZKInterface</a></li>
 
148
        
 
149
        </ul>
 
150
        <div id="no-class-search-results" style="display: none;">No matching classes.</div>
 
151
      </div>
 
152
 
 
153
      
 
154
    </div>
 
155
  </div>
 
156
 
 
157
  <div id="documentation">
 
158
    <h1 class="class">ZKInterface</h1>
 
159
 
 
160
    <div id="description">
 
161
      
 
162
    </div>
 
163
 
 
164
    <!-- Constants -->
 
165
    
 
166
 
 
167
    <!-- Attributes -->
 
168
    
 
169
 
 
170
    <!-- Methods -->
 
171
    
 
172
    <div id="public-class-method-details" class="method-section section">
 
173
      <h3 class="section-header">Public Class Methods</h3>
 
174
 
 
175
    
 
176
      <div id="add_app_entry-method" class="method-detail ">
 
177
        <a name="method-c-add_app_entry"></a>
 
178
 
 
179
        
 
180
        <div class="method-heading">
 
181
          <span class="method-name">add_app_entry</span><span
 
182
            class="method-args">(appname, ip, location)</span>
 
183
          <span class="method-click-advice">click to toggle source</span>
 
184
        </div>
 
185
        
 
186
 
 
187
        <div class="method-description">
 
188
          
 
189
          
 
190
          
 
191
 
 
192
          
 
193
          <div class="method-source-code"
 
194
            id="add_app_entry-source">
 
195
<pre>
 
196
<span class="ruby-comment"># File lib/zkinterface.rb, line 35</span>
 
197
def self.add_app_entry(appname, ip, location)
 
198
  appname_path = <span class="ruby-constant">ROOT_APP_PATH</span> + &quot;/#{appname}&quot;
 
199
  full_path = appname_path + &quot;/#{ip}&quot;
 
200
 
 
201
  <span class="ruby-comment"># can't just create path in ZK</span>
 
202
  <span class="ruby-comment"># need to do create the nodes at each level</span>
 
203
 
 
204
  self.set(<span class="ruby-constant">ROOT_APP_PATH</span>, <span class="ruby-string">&quot;nothing special here&quot;</span>, <span class="ruby-constant">NOT_EPHEMERAL</span>)
 
205
  self.set(appname_path, <span class="ruby-string">&quot;nothing special here&quot;</span>, <span class="ruby-constant">NOT_EPHEMERAL</span>)
 
206
  self.set(full_path, location, <span class="ruby-constant">EPHEMERAL</span>)
 
207
end</pre>
 
208
          </div>
 
209
          
 
210
        </div>
 
211
 
 
212
        
 
213
 
 
214
        
 
215
      </div>
 
216
 
 
217
    
 
218
      <div id="get_app_hosters-method" class="method-detail ">
 
219
        <a name="method-c-get_app_hosters"></a>
 
220
 
 
221
        
 
222
        <div class="method-heading">
 
223
          <span class="method-name">get_app_hosters</span><span
 
224
            class="method-args">(appname)</span>
 
225
          <span class="method-click-advice">click to toggle source</span>
 
226
        </div>
 
227
        
 
228
 
 
229
        <div class="method-description">
 
230
          
 
231
          
 
232
          
 
233
 
 
234
          
 
235
          <div class="method-source-code"
 
236
            id="get_app_hosters-source">
 
237
<pre>
 
238
<span class="ruby-comment"># File lib/zkinterface.rb, line 52</span>
 
239
def self.get_app_hosters(appname)
 
240
  unless defined?(@@zk)
 
241
    return []
 
242
  end
 
243
 
 
244
  appname_path = <span class="ruby-constant">ROOT_APP_PATH</span> + &quot;/#{appname}&quot;
 
245
  app_hosters = self.get_children(appname_path)
 
246
  <span class="ruby-comment">#converted = app_hosters</span>
 
247
  converted = []
 
248
  app_hosters.each { |serialized|
 
249
    converted &lt;&lt; <span class="ruby-constant">DjinnJobData</span>.deserialize(serialized)
 
250
  }
 
251
  return converted
 
252
end</pre>
 
253
          </div>
 
254
          
 
255
        </div>
 
256
 
 
257
        
 
258
 
 
259
        
 
260
      </div>
 
261
 
 
262
    
 
263
      <div id="init-method" class="method-detail ">
 
264
        <a name="method-c-init"></a>
 
265
 
 
266
        
 
267
        <div class="method-heading">
 
268
          <span class="method-name">init</span><span
 
269
            class="method-args">(my_node, all_nodes)</span>
 
270
          <span class="method-click-advice">click to toggle source</span>
 
271
        </div>
 
272
        
 
273
 
 
274
        <div class="method-description">
 
275
          
 
276
          
 
277
          
 
278
 
 
279
          
 
280
          <div class="method-source-code"
 
281
            id="init-source">
 
282
<pre>
 
283
<span class="ruby-comment"># File lib/zkinterface.rb, line 20</span>
 
284
def self.init(my_node, all_nodes)
 
285
  require <span class="ruby-string">'rubygems'</span>
 
286
  require <span class="ruby-string">'zookeeper'</span>
 
287
 
 
288
  unless defined?(@@lock)
 
289
    @@lock = <span class="ruby-constant">Monitor</span>.new
 
290
  end
 
291
 
 
292
  zk_location = self.get_zk_location(my_node, all_nodes)
 
293
 
 
294
  @@lock.synchronize {
 
295
    @@zk = <span class="ruby-constant">Zookeeper</span>.new(zk_location)
 
296
  }
 
297
end</pre>
 
298
          </div>
 
299
          
 
300
        </div>
 
301
 
 
302
        
 
303
 
 
304
        
 
305
      </div>
 
306
 
 
307
    
 
308
      <div id="remove_app_entry-method" class="method-detail ">
 
309
        <a name="method-c-remove_app_entry"></a>
 
310
 
 
311
        
 
312
        <div class="method-heading">
 
313
          <span class="method-name">remove_app_entry</span><span
 
314
            class="method-args">(appname)</span>
 
315
          <span class="method-click-advice">click to toggle source</span>
 
316
        </div>
 
317
        
 
318
 
 
319
        <div class="method-description">
 
320
          
 
321
          
 
322
          
 
323
 
 
324
          
 
325
          <div class="method-source-code"
 
326
            id="remove_app_entry-source">
 
327
<pre>
 
328
<span class="ruby-comment"># File lib/zkinterface.rb, line 47</span>
 
329
def self.remove_app_entry(appname)
 
330
  appname_path = <span class="ruby-constant">ROOT_APP_PATH</span> + &quot;/#{appname}&quot;
 
331
  self.delete(appname_path)
 
332
end</pre>
 
333
          </div>
 
334
          
 
335
        </div>
 
336
 
 
337
        
 
338
 
 
339
        
 
340
      </div>
 
341
 
 
342
    
 
343
    </div>
 
344
  
 
345
 
 
346
  </div>
 
347
 
 
348
  <div id="validator-badges">
 
349
    <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
 
350
    <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
 
351
      Rdoc Generator</a> 2</small>.</p>
 
352
  </div>
 
353
 
 
354
</body>
 
355
</html>
 
356