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 | |
__in_request | |
__master | |
__slaves |
A master-slave connection to Mongo.
Definition at line 26 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::__cmp__ | ( | self, | ||
other | ||||
) |
Definition at line 172 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::__getattr__ | ( | self, | ||
name | ||||
) |
Get a database by name. Raises InvalidName if an invalid database name is used. :Parameters: - `name`: the name of the database to get
Definition at line 181 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::__getitem__ | ( | self, | ||
name | ||||
) |
Get a database by name. Raises InvalidName if an invalid database name is used. :Parameters: - `name`: the name of the database to get
Definition at line 191 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::__init__ | ( | self, | ||
master, | ||||
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. :Parameters: - `master`: `Connection` instance for the writable Master - `slaves` (optional): list of `Connection` instances for the read-only slaves
Definition at line 30 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::__iter__ | ( | self | ) |
Definition at line 231 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::__repr__ | ( | self | ) |
Definition at line 178 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::_cache_index | ( | self, | ||
database_name, | ||||
collection_name, | ||||
index_name, | ||||
ttl | ||||
) | [private] |
Definition at line 237 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::_purge_index | ( | self, | ||
database_name, | ||||
collection_name = None , |
||||
index_name = None | ||||
) | [private] |
Definition at line 241 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::_send_message | ( | self, | ||
message, | ||||
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. :Parameters: - `operation`: opcode of the message - `data`: data to send - `safe`: perform a getLastError after sending the message
Definition at line 100 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::_send_message_with_response | ( | self, | ||
message, | ||||
_connection_to_use = None , |
||||
_must_use_master = False , |
||||
kwargs | ||||
) | [private] |
Receive a message from Mongo. Sends the given message and returns a (connection_id, response) pair. :Parameters: - `operation`: opcode of the message to send - `data`: data to send
Definition at line 121 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::close_cursor | ( | self, | ||
cursor_id, | ||||
connection_id | ||||
) |
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 manager. :Parameters: - `cursor_id`: cursor id to close - `connection_id`: id of the `Connection` instance where the cursor was opened
Definition at line 201 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::database_names | ( | self | ) |
Get a list of all database names.
Definition at line 217 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::document_class | ( | self | ) |
Definition at line 71 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::drop_database | ( | self, | ||
name_or_database | ||||
) |
Drop a database. :Parameters: - `name_or_database`: the name of a database to drop or the object itself
Definition at line 222 of file master_slave_connection.py.
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 master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::master | ( | self | ) |
Definition at line 62 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::next | ( | self | ) |
Definition at line 234 of file master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::set_cursor_manager | ( | self, | ||
manager_class | ||||
) |
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 master_slave_connection.py.
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 master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::slaves | ( | self | ) |
Definition at line 66 of file master_slave_connection.py.
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 master_slave_connection.py.
def pymongo::master_slave_connection::MasterSlaveConnection::tz_aware | ( | self | ) |
Definition at line 76 of file master_slave_connection.py.
Definition at line 57 of file master_slave_connection.py.
Definition at line 58 of file master_slave_connection.py.
Definition at line 59 of file master_slave_connection.py.