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


Public Member Functions | |
| def | __init__ (self, mode, tag_sets=None, max_staleness=-1, hedge=None) |
| def | name (self) |
| def | mongos_mode (self) |
| def | document (self) |
| def | mode (self) |
| def | tag_sets (self) |
| def | max_staleness (self) |
| def | hedge (self) |
| def | min_wire_version (self) |
| def | __repr__ (self) |
| def | __eq__ (self, other) |
| def | __ne__ (self, other) |
| def | __getstate__ (self) |
| def | __setstate__ (self, value) |
Data Fields | |
| mode | |
| tag_sets | |
| max_staleness | |
| hedge | |
Base class for all read preferences.
| def __init__ | ( | self, | |
| mode, | |||
tag_sets = None, |
|||
max_staleness = -1, |
|||
hedge = None |
|||
| ) |
| def __eq__ | ( | self, | |
| other | |||
| ) |
Reimplemented in Primary.
| def __getstate__ | ( | self | ) |
Return value of object for pickling. Needed explicitly because __slots__() defined.
| def __ne__ | ( | self, | |
| other | |||
| ) |
| def __repr__ | ( | self | ) |
Reimplemented in Primary.
| def __setstate__ | ( | self, | |
| value | |||
| ) |
Restore from pickling.
| def document | ( | self | ) |
Read preference as a document.
| def hedge | ( | self | ) |
The read preference ``hedge`` parameter.
A dictionary that configures how the server will perform hedged reads.
It consists of the following keys:
- ``enabled``: Enables or disables hedged reads in sharded clusters.
Hedged reads are automatically enabled in MongoDB 4.4+ when using a
``nearest`` read preference. To explicitly enable hedged reads, set
the ``enabled`` key to ``true``::
>>> Nearest(hedge={'enabled': True})
To explicitly disable hedged reads, set the ``enabled`` key to
``False``::
>>> Nearest(hedge={'enabled': False})
.. versionadded:: 3.11
| def max_staleness | ( | self | ) |
The maximum estimated length of time (in seconds) a replica set secondary can fall behind the primary in replication before it will no longer be selected for operations, or -1 for no maximum.
| def min_wire_version | ( | self | ) |
The wire protocol version the server must support. Some read preferences impose version requirements on all servers (e.g. maxStalenessSeconds requires MongoDB 3.4 / maxWireVersion 5). All servers' maxWireVersion must be at least this read preference's `min_wire_version`, or the driver raises :exc:`~pymongo.errors.ConfigurationError`.
| def mode | ( | self | ) |
The mode of this read preference instance.
| def mongos_mode | ( | self | ) |
The mongos mode of this read preference.
| def name | ( | self | ) |
The name of this read preference.
| def tag_sets | ( | self | ) |
Set ``tag_sets`` to a list of dictionaries like [{'dc': 'ny'}] to
read only from members whose ``dc`` tag has the value ``"ny"``.
To specify a priority-order for tag sets, provide a list of
tag sets: ``[{'dc': 'ny'}, {'dc': 'la'}, {}]``. A final, empty tag
set, ``{}``, means "read from any member that matches the mode,
ignoring tags." MongoReplicaSetClient tries each set of tags in turn
until it finds a set of tags with at least one matching member.
.. seealso:: `Data-Center Awareness
<http://www.mongodb.org/display/DOCS/Data+Center+Awareness>`_
| hedge |
| max_staleness |
| mode |
| tag_sets |