Top Level Namespace

Defined Under Namespace

Modules: ConsistentCluster

Instance Method Summary collapse

Instance Method Details

#clearObject



28
29
30
31
32
33
# File 'lib/consistent-cluster/demo/zk_debug.rb', line 28

def clear
  apps = $zk.children($path)
  apps.each do |app_name|
    delete_with_app_name(app_name)
  end
end

#create(hash) ⇒ Object



8
9
10
11
12
# File 'lib/consistent-cluster/demo/zk_debug.rb', line 8

def create(hash)
  app_name = hash[:id]

  $zk.create("#{$path}/#{app_name}",hash.to_json)
end

#delete(hash) ⇒ Object



19
20
21
22
# File 'lib/consistent-cluster/demo/zk_debug.rb', line 19

def delete(hash)
  app_name = hash[:id]
  delete_with_app_name(app_name)
end

#delete_with_app_name(app_name) ⇒ Object



24
25
26
# File 'lib/consistent-cluster/demo/zk_debug.rb', line 24

def delete_with_app_name(app_name)
  $zk.delete("#{$path}/#{app_name}")
end

#set(hash) ⇒ Object



14
15
16
17
# File 'lib/consistent-cluster/demo/zk_debug.rb', line 14

def set(hash)
  app_name = hash[:id]
  $zk.set("#{$path}/#{app_name}",hash.to_json)
end