Class: Bones::RPC::Context
- Inherits:
-
Object
- Object
- Bones::RPC::Context
- Includes:
- Readable
- Defined in:
- lib/bones/rpc/context.rb
Overview
The class for interacting with a MongoDB database. One only interacts with this class indirectly through a session.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(session) ⇒ Context
constructor
Initialize the database.
- #notify(method, params) ⇒ Object
- #request(method, params) ⇒ Object
- #synchronize ⇒ Object
Constructor Details
#initialize(session) ⇒ Context
Initialize the database.
25 26 27 |
# File 'lib/bones/rpc/context.rb', line 25 def initialize(session) @session = session end |
Instance Attribute Details
#session ⇒ Object
14 15 16 |
# File 'lib/bones/rpc/context.rb', line 14 def session @session end |
Instance Method Details
#notify(method, params) ⇒ Object
29 30 31 32 33 |
# File 'lib/bones/rpc/context.rb', line 29 def notify(method, params) read_preference.with_node(cluster) do |node| node.notify(method, params) end end |
#request(method, params) ⇒ Object
35 36 37 38 39 |
# File 'lib/bones/rpc/context.rb', line 35 def request(method, params) read_preference.with_node(cluster) do |node| node.request(method, params) end end |
#synchronize ⇒ Object
41 42 43 44 45 |
# File 'lib/bones/rpc/context.rb', line 41 def synchronize read_preference.with_node(cluster) do |node| node.synchronize end end |