pymongo::master_slave_connection::MasterSlaveConnection Class Reference

List of all members.

Public Member Functions

def __cmp__
def __getattr__
def __getitem__
def __init__
def __iter__
def __repr__
def close_cursor
def database_names
def document_class
def drop_database
def end_request
def master
def next
def set_cursor_manager
def slave_okay
def slaves
def start_request
def tz_aware

Private Member Functions

def _cache_index
def _purge_index
def _send_message
def _send_message_with_response

Private Attributes


Detailed Description

A master-slave connection to Mongo.

Definition at line 26 of file

Member Function Documentation

def pymongo::master_slave_connection::MasterSlaveConnection::__cmp__ (   self,

Definition at line 172 of file

def pymongo::master_slave_connection::MasterSlaveConnection::__getattr__ (   self,
Get a database by name.

Raises InvalidName if an invalid database name is used.

  - `name`: the name of the database to get

Definition at line 181 of file

def pymongo::master_slave_connection::MasterSlaveConnection::__getitem__ (   self,
Get a database by name.

Raises InvalidName if an invalid database name is used.

  - `name`: the name of the database to get

Definition at line 191 of file

def pymongo::master_slave_connection::MasterSlaveConnection::__init__ (   self,
  slaves = [] 
Create a new Master-Slave connection.

The resultant connection should be interacted with using the same
mechanisms as a regular `Connection`. The `Connection` instances used
to create this `MasterSlaveConnection` can themselves make use of
connection pooling, etc. 'Connection' instances used as slaves should
be created with the slave_okay option set to True.

Raises TypeError if `master` is not an instance of `Connection` or
slaves is not a list of at least one `Connection` instances.

  - `master`: `Connection` instance for the writable Master
  - `slaves` (optional): list of `Connection` instances for the
    read-only slaves

Definition at line 30 of file

def pymongo::master_slave_connection::MasterSlaveConnection::__iter__ (   self  ) 

Definition at line 231 of file

def pymongo::master_slave_connection::MasterSlaveConnection::__repr__ (   self  ) 

Definition at line 178 of file

def pymongo::master_slave_connection::MasterSlaveConnection::_cache_index (   self,
) [private]

Definition at line 237 of file

def pymongo::master_slave_connection::MasterSlaveConnection::_purge_index (   self,
  collection_name = None,
  index_name = None 
) [private]

Definition at line 241 of file

def pymongo::master_slave_connection::MasterSlaveConnection::_send_message (   self,
  safe = False,
  _connection_to_use = None 
) [private]
Say something to Mongo.

Sends a message on the Master connection. This is used for inserts,
updates, and deletes.

Raises ConnectionFailure if the message cannot be sent. Returns the
request id of the sent message.

  - `operation`: opcode of the message
  - `data`: data to send
  - `safe`: perform a getLastError after sending the message

Definition at line 100 of file

def pymongo::master_slave_connection::MasterSlaveConnection::_send_message_with_response (   self,
  _connection_to_use = None,
  _must_use_master = False,
) [private]
Receive a message from Mongo.

Sends the given message and returns a (connection_id, response) pair.

  - `operation`: opcode of the message to send
  - `data`: data to send

Definition at line 121 of file

def pymongo::master_slave_connection::MasterSlaveConnection::close_cursor (   self,
Close a single database cursor.

Raises TypeError if cursor_id is not an instance of (int, long). What
closing the cursor actually means depends on this connection's cursor

  - `cursor_id`: cursor id to close
  - `connection_id`: id of the `Connection` instance where the cursor
    was opened

Definition at line 201 of file

def pymongo::master_slave_connection::MasterSlaveConnection::database_names (   self  ) 
Get a list of all database names.

Definition at line 217 of file

def pymongo::master_slave_connection::MasterSlaveConnection::document_class (   self  ) 

Definition at line 71 of file

def pymongo::master_slave_connection::MasterSlaveConnection::drop_database (   self,
Drop a database.

  - `name_or_database`: the name of a database to drop or the object

Definition at line 222 of file

def pymongo::master_slave_connection::MasterSlaveConnection::end_request (   self  ) 
End the current "request".

See documentation for `Connection.end_request`.

Definition at line 164 of file

def pymongo::master_slave_connection::MasterSlaveConnection::master (   self  ) 

Definition at line 62 of file

def pymongo::master_slave_connection::MasterSlaveConnection::next (   self  ) 

Definition at line 234 of file

def pymongo::master_slave_connection::MasterSlaveConnection::set_cursor_manager (   self,
Set the cursor manager for this connection.

Helper to set cursor manager for each individual `Connection` instance
that make up this `MasterSlaveConnection`.

Definition at line 87 of file

def pymongo::master_slave_connection::MasterSlaveConnection::slave_okay (   self  ) 
Is it okay for this connection to connect directly to a slave?

This is always True for MasterSlaveConnection instances.

Definition at line 80 of file

def pymongo::master_slave_connection::MasterSlaveConnection::slaves (   self  ) 

Definition at line 66 of file

def pymongo::master_slave_connection::MasterSlaveConnection::start_request (   self  ) 
Start a "request".

Start a sequence of operations in which order matters. Note
that all operations performed within a request will be sent
using the Master connection.

Definition at line 155 of file

def pymongo::master_slave_connection::MasterSlaveConnection::tz_aware (   self  ) 

Definition at line 76 of file

Member Data Documentation

Definition at line 57 of file

Definition at line 58 of file

Definition at line 59 of file

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Author(s): Bhaskara Marthi
autogenerated on Fri Jan 11 10:09:06 2013