Module: Disbatch
Defined Under Namespace
Modules: Plugin Classes: AlreadyRegisteredNodeError, FailedLoadPluginError, NoDatabaseError, NoNodeError, NoPluginError, NoQueueError, Node, NotRegisteredNodeError, Queue, RegisteredNodeError, Task
Constant Summary collapse
- VERSION =
engine version
'rdisbatch 0.0.9'- SPEC_VERSION =
specification version
'1.9'
Instance Attribute Summary collapse
-
#mongo_db ⇒ Object
Returns the value of attribute mongo_db.
-
#mongo_host ⇒ Object
Returns the value of attribute mongo_host.
-
#mongo_opts ⇒ Object
Returns the value of attribute mongo_opts.
-
#mongo_port ⇒ Object
Returns the value of attribute mongo_port.
-
#node_id ⇒ Object
Returns the value of attribute node_id.
Instance Method Summary collapse
-
#db ⇒ Object
Return and cache the MongoDB connection pool.
-
#node ⇒ Object
Return and cache the local node object.
Instance Attribute Details
#mongo_db ⇒ Object
Returns the value of attribute mongo_db.
10 11 12 |
# File 'lib/disbatch.rb', line 10 def mongo_db @mongo_db end |
#mongo_host ⇒ Object
Returns the value of attribute mongo_host.
8 9 10 |
# File 'lib/disbatch.rb', line 8 def mongo_host @mongo_host end |
#mongo_opts ⇒ Object
Returns the value of attribute mongo_opts.
11 12 13 |
# File 'lib/disbatch.rb', line 11 def mongo_opts @mongo_opts end |
#mongo_port ⇒ Object
Returns the value of attribute mongo_port.
9 10 11 |
# File 'lib/disbatch.rb', line 9 def mongo_port @mongo_port end |
#node_id ⇒ Object
Returns the value of attribute node_id.
13 14 15 |
# File 'lib/disbatch.rb', line 13 def node_id @node_id end |
Instance Method Details
#db ⇒ Object
Return and cache the MongoDB connection pool
32 33 34 35 36 37 38 39 40 |
# File 'lib/disbatch.rb', line 32 def db begin @db ||= Mongo::Connection.new(@mongo_host, @mongo_port).db(@mongo_db) rescue raise Disbatch::NoDatabaseError end @db end |
#node ⇒ Object
Return and cache the local node object
43 44 45 46 47 48 49 |
# File 'lib/disbatch.rb', line 43 def node begin @node ||= Disbatch::Node.get(@node_id) rescue Disbatch::NoNodeError Disbatch::Node.create(@node_id) end end |