class DCell::Registry::MongodbAdapter

Public Class Methods

new(options) click to toggle source

Setup connection to mongodb config: path to mongoid configuration file env: mongoid environment to use

# File lib/dcell/registries/mongodb_adapter.rb, line 9
def initialize(options)
  if options[:config]
    Mongoid.load! options[:config], options[:env]
  elsif options[:db]
    Mongoid.connect_to options[:db]
  end
  if options[:options]
    Mongoid.options = options[:options]
  end
end

Public Instance Methods

clear_all_nodes() click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 76
def clear_all_nodes;         Proxy.clear_all(DCellNode) end
clear_globals() click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 81
def clear_globals;           Proxy.clear_all(DCellGlobal) end
get_global(key) click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 78
def get_global(key);         Proxy.get(DCellGlobal, key) end
get_node(node_id) click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 72
def get_node(node_id);       Proxy.get(DCellNode, node_id) end
global_keys() click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 80
def global_keys;             Proxy.all(DCellGlobal) end
nodes() click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 74
def nodes;                   Proxy.all(DCellNode) end
remove_node(node_id) click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 75
def remove_node(node_id);    Proxy.remove(DCellNode, node_id) end
set_global(key, value) click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 79
def set_global(key, value);  Proxy.set(DCellGlobal, key, value) end
set_node(node_id, addr) click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 73
def set_node(node_id, addr); Proxy.set(DCellNode, node_id, addr) end