Module: Blackhole
- Defined in:
- lib/hole.rb,
lib/runner.rb,
lib/blackhole.rb
Defined Under Namespace
Classes: Hole, HoleConnection, Runner
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
-
.mongo ⇒ Object
Returns a mongo connection (NOT an em-mongo connection).
-
.mongo_db_name ⇒ Object
Info to connect to mongo.
-
.mongo_hostports ⇒ Object
Returns the value of attribute mongo_hostports.
Class Method Summary collapse
- .collection(collection_name) ⇒ Object
- .collection_for(namespace) ⇒ Object
- .mongo_collection_name(namespace) ⇒ Object
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/blackhole.rb', line 3 def logger @logger end |
.mongo ⇒ Object
Returns a mongo connection (NOT an em-mongo connection)
6 7 8 |
# File 'lib/blackhole.rb', line 6 def mongo @mongo end |
.mongo_db_name ⇒ Object
Info to connect to mongo
9 10 11 |
# File 'lib/blackhole.rb', line 9 def mongo_db_name @mongo_db_name end |
.mongo_hostports ⇒ Object
Returns the value of attribute mongo_hostports.
10 11 12 |
# File 'lib/blackhole.rb', line 10 def mongo_hostports @mongo_hostports end |
Class Method Details
.collection(collection_name) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/blackhole.rb', line 36 def collection(collection_name) @collections ||= {} @collections[collection_name] ||= begin c = mongo.collection(collection_name) c.ensure_index([["t", 1]], {:background => true, :unique => true}) c.ensure_index([["host", 1]], {:background => true, :unique => true}) c end end |
.collection_for(namespace) ⇒ Object
50 51 52 |
# File 'lib/blackhole.rb', line 50 def collection_for(namespace) collection(mongo_collection_name(namespace)) end |
.mongo_collection_name(namespace) ⇒ Object
46 47 48 |
# File 'lib/blackhole.rb', line 46 def mongo_collection_name(namespace) "blackhole_#{namespace}" end |