class Bones::RPC::Context

The class for interacting with a MongoDB database. One only interacts with this class indirectly through a session.

@since 0.0.1

Attributes

session[R]

@!attribute session

@return [ Session ] The database session.

Public Class Methods

new(session) click to toggle source

Initialize the database.

@example Initialize a database object.

Database.new(session, :artists)

@param [ Session ] session The session. @param [ String, Symbol ] name The name of the database.

@since 0.0.1

# File lib/bones/rpc/context.rb, line 25
def initialize(session)
  @session = session
end

Public Instance Methods

notify(method, params) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/bones/rpc/context.rb, line 41
def synchronize
  read_preference.with_node(cluster) do |node|
    node.synchronize
  end
end