|
OpenQuizz
Une application de gestion des contenus pédagogiques
|


Public Member Functions | |
| def | __init__ (self, topology_settings) |
| def | open (self) |
| def | select_servers (self, selector, server_selection_timeout=None, address=None) |
| def | select_server (self, selector, server_selection_timeout=None, address=None) |
| def | select_server_by_address (self, address, server_selection_timeout=None) |
| def | on_change (self, server_description, reset_pool=False) |
| def | on_srv_update (self, seedlist) |
| def | get_server_by_address (self, address) |
| def | has_server (self, address) |
| def | get_primary (self) |
| def | get_secondaries (self) |
| def | get_arbiters (self) |
| def | max_cluster_time (self) |
| def | receive_cluster_time (self, cluster_time) |
| def | request_check_all (self, wait_time=5) |
| def | handle_getlasterror (self, address, error_msg) |
| def | data_bearing_servers (self) |
| def | update_pool (self, all_credentials) |
| def | close (self) |
| def | description (self) |
| def | pop_all_sessions (self) |
| def | get_server_session (self) |
| def | return_server_session (self, server_session, lock) |
| def | handle_error (self, address, err_ctx) |
| def | __repr__ (self) |
Monitor a topology of one or more servers.
| def __init__ | ( | self, | |
| topology_settings | |||
| ) |
| def __repr__ | ( | self | ) |
| def close | ( | self | ) |
Clear pools and terminate monitors. Topology reopens on demand.
| def data_bearing_servers | ( | self | ) |
Return a list of all data-bearing servers. This includes any server that might be selected for an operation.
| def description | ( | self | ) |
| def get_arbiters | ( | self | ) |
Return set of arbiter addresses.
| def get_primary | ( | self | ) |
Return primary's address or None.
| def get_secondaries | ( | self | ) |
Return set of secondary addresses.
| def get_server_by_address | ( | self, | |
| address | |||
| ) |
Get a Server or None. Returns the current version of the server immediately, even if it's Unknown or absent from the topology. Only use this in unittests. In driver code, use select_server_by_address, since then you're assured a recent view of the server's type and wire protocol version.
| def get_server_session | ( | self | ) |
Start or resume a server session, or raise ConfigurationError.
| def handle_error | ( | self, | |
| address, | |||
| err_ctx | |||
| ) |
Handle an application error. May reset the server to Unknown, clear the pool, and request an immediate check depending on the error and the context.
| def handle_getlasterror | ( | self, | |
| address, | |||
| error_msg | |||
| ) |
Clear our pool for a server, mark it Unknown, and check it soon.
| def has_server | ( | self, | |
| address | |||
| ) |
| def max_cluster_time | ( | self | ) |
Return a document, the highest seen $clusterTime.
| def on_change | ( | self, | |
| server_description, | |||
reset_pool = False |
|||
| ) |
Process a new ServerDescription after an ismaster call completes.
| def on_srv_update | ( | self, | |
| seedlist | |||
| ) |
Process a new list of nodes obtained from scanning SRV records.
| def open | ( | self | ) |
Start monitoring, or restart after a fork. No effect if called multiple times. .. warning:: Topology is shared among multiple threads and is protected by mutual exclusion. Using Topology from a process other than the one that initialized it will emit a warning and may result in deadlock. To prevent this from happening, MongoClient must be created after any forking.
| def pop_all_sessions | ( | self | ) |
Pop all session ids from the pool.
| def receive_cluster_time | ( | self, | |
| cluster_time | |||
| ) |
| def request_check_all | ( | self, | |
wait_time = 5 |
|||
| ) |
Wake all monitors, wait for at least one to check its server.
| def return_server_session | ( | self, | |
| server_session, | |||
| lock | |||
| ) |
| def select_server | ( | self, | |
| selector, | |||
server_selection_timeout = None, |
|||
address = None |
|||
| ) |
Like select_servers, but choose a random server if several match.
| def select_server_by_address | ( | self, | |
| address, | |||
server_selection_timeout = None |
|||
| ) |
Return a Server for "address", reconnecting if necessary.
If the server's type is not known, request an immediate check of all
servers. Time out after "server_selection_timeout" if the server
cannot be reached.
:Parameters:
- `address`: A (host, port) pair.
- `server_selection_timeout` (optional): maximum seconds to wait.
If not provided, the default value
common.SERVER_SELECTION_TIMEOUT is used.
Calls self.open() if needed.
Raises exc:`ServerSelectionTimeoutError` after
`server_selection_timeout` if no matching servers are found.
| def select_servers | ( | self, | |
| selector, | |||
server_selection_timeout = None, |
|||
address = None |
|||
| ) |
Return a list of Servers matching selector, or time out.
:Parameters:
- `selector`: function that takes a list of Servers and returns
a subset of them.
- `server_selection_timeout` (optional): maximum seconds to wait.
If not provided, the default value common.SERVER_SELECTION_TIMEOUT
is used.
- `address`: optional server address to select.
Calls self.open() if needed.
Raises exc:`ServerSelectionTimeoutError` after
`server_selection_timeout` if no matching servers are found.
| def update_pool | ( | self, | |
| all_credentials | |||
| ) |