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">
6
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
8
<title>Class: ZKInterface</title>
10
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
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>
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>
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">
41
<li><a href="./lib/zkinterface_rb.html?TB_iframe=true&height=550&width=785"
42
class="thickbox" title="lib/zkinterface.rb">lib/zkinterface.rb</a></li>
51
<div id="class-metadata">
55
<div id="parent-class-section" class="section">
56
<h3 class="section-header">Parent</h3>
58
<p class="link"><a href="Object.html">Object</a></p>
63
<!-- Namespace Contents -->
66
<!-- Method Quickref -->
68
<div id="method-list-section" class="section">
69
<h3 class="section-header">Methods</h3>
70
<ul class="link-list">
72
<li><a href="#method-c-add_app_entry">::add_app_entry</a></li>
74
<li><a href="#method-c-get_app_hosters">::get_app_hosters</a></li>
76
<li><a href="#method-c-init">::init</a></li>
78
<li><a href="#method-c-remove_app_entry">::remove_app_entry</a></li>
84
<!-- Included Modules -->
88
<div id="project-metadata">
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">
99
<legend>Quicksearch</legend>
100
<input type="text" name="quicksearch" value=""
101
class="quicksearch-field" />
105
<ul class="link-list">
107
<li><a href="./AppControllerClient.html">AppControllerClient</a></li>
109
<li><a href="./BlobServer.html">BlobServer</a></li>
111
<li><a href="./Collectd.html">Collectd</a></li>
113
<li><a href="./CronHelper.html">CronHelper</a></li>
115
<li><a href="./Djinn.html">Djinn</a></li>
117
<li><a href="./DjinnJobData.html">DjinnJobData</a></li>
119
<li><a href="./DjinnServer.html">DjinnServer</a></li>
121
<li><a href="./Ejabberd.html">Ejabberd</a></li>
123
<li><a href="./GodInterface.html">GodInterface</a></li>
125
<li><a href="./HAProxy.html">HAProxy</a></li>
127
<li><a href="./HelperFunctions.html">HelperFunctions</a></li>
129
<li><a href="./JSONClient.html">JSONClient</a></li>
131
<li><a href="./LoadBalancer.html">LoadBalancer</a></li>
133
<li><a href="./Monitoring.html">Monitoring</a></li>
135
<li><a href="./Nginx.html">Nginx</a></li>
137
<li><a href="./Object.html">Object</a></li>
139
<li><a href="./PbServer.html">PbServer</a></li>
141
<li><a href="./RabbitMQ.html">RabbitMQ</a></li>
143
<li><a href="./Repo.html">Repo</a></li>
145
<li><a href="./UserAppClient.html">UserAppClient</a></li>
147
<li><a href="./ZKInterface.html">ZKInterface</a></li>
150
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
157
<div id="documentation">
158
<h1 class="class">ZKInterface</h1>
160
<div id="description">
172
<div id="public-class-method-details" class="method-section section">
173
<h3 class="section-header">Public Class Methods</h3>
176
<div id="add_app_entry-method" class="method-detail ">
177
<a name="method-c-add_app_entry"></a>
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>
187
<div class="method-description">
193
<div class="method-source-code"
194
id="add_app_entry-source">
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> + "/#{appname}"
199
full_path = appname_path + "/#{ip}"
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>
204
self.set(<span class="ruby-constant">ROOT_APP_PATH</span>, <span class="ruby-string">"nothing special here"</span>, <span class="ruby-constant">NOT_EPHEMERAL</span>)
205
self.set(appname_path, <span class="ruby-string">"nothing special here"</span>, <span class="ruby-constant">NOT_EPHEMERAL</span>)
206
self.set(full_path, location, <span class="ruby-constant">EPHEMERAL</span>)
218
<div id="get_app_hosters-method" class="method-detail ">
219
<a name="method-c-get_app_hosters"></a>
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>
229
<div class="method-description">
235
<div class="method-source-code"
236
id="get_app_hosters-source">
238
<span class="ruby-comment"># File lib/zkinterface.rb, line 52</span>
239
def self.get_app_hosters(appname)
240
unless defined?(@@zk)
244
appname_path = <span class="ruby-constant">ROOT_APP_PATH</span> + "/#{appname}"
245
app_hosters = self.get_children(appname_path)
246
<span class="ruby-comment">#converted = app_hosters</span>
248
app_hosters.each { |serialized|
249
converted << <span class="ruby-constant">DjinnJobData</span>.deserialize(serialized)
263
<div id="init-method" class="method-detail ">
264
<a name="method-c-init"></a>
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>
274
<div class="method-description">
280
<div class="method-source-code"
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>
288
unless defined?(@@lock)
289
@@lock = <span class="ruby-constant">Monitor</span>.new
292
zk_location = self.get_zk_location(my_node, all_nodes)
295
@@zk = <span class="ruby-constant">Zookeeper</span>.new(zk_location)
308
<div id="remove_app_entry-method" class="method-detail ">
309
<a name="method-c-remove_app_entry"></a>
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>
319
<div class="method-description">
325
<div class="method-source-code"
326
id="remove_app_entry-source">
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> + "/#{appname}"
331
self.delete(appname_path)
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>