Immutable representation of one server. :param address: A (host, port) pair :param hello: Optional Hello instance :param round_trip_time: Optional float :param error: Optional, the last error attempting to connect to the server :param round_trip_time: Optional float, the min lat
| 30 | |
| 31 | |
| 32 | class ServerDescription: |
| 33 | """Immutable representation of one server. |
| 34 | |
| 35 | :param address: A (host, port) pair |
| 36 | :param hello: Optional Hello instance |
| 37 | :param round_trip_time: Optional float |
| 38 | :param error: Optional, the last error attempting to connect to the server |
| 39 | :param round_trip_time: Optional float, the min latency from the most recent samples |
| 40 | """ |
| 41 | |
| 42 | __slots__ = ( |
| 43 | "_address", |
| 44 | "_server_type", |
| 45 | "_all_hosts", |
| 46 | "_tags", |
| 47 | "_replica_set_name", |
| 48 | "_primary", |
| 49 | "_max_bson_size", |
| 50 | "_max_message_size", |
| 51 | "_max_write_batch_size", |
| 52 | "_min_wire_version", |
| 53 | "_max_wire_version", |
| 54 | "_round_trip_time", |
| 55 | "_min_round_trip_time", |
| 56 | "_me", |
| 57 | "_is_writable", |
| 58 | "_is_readable", |
| 59 | "_ls_timeout_minutes", |
| 60 | "_error", |
| 61 | "_set_version", |
| 62 | "_election_id", |
| 63 | "_cluster_time", |
| 64 | "_last_write_date", |
| 65 | "_last_update_time", |
| 66 | "_topology_version", |
| 67 | ) |
| 68 | |
| 69 | def __init__( |
| 70 | self, |
| 71 | address: _Address, |
| 72 | hello: Optional[Hello[dict[str, Any]]] = None, |
| 73 | round_trip_time: Optional[float] = None, |
| 74 | error: Optional[Exception] = None, |
| 75 | min_round_trip_time: float = 0.0, |
| 76 | ) -> None: |
| 77 | self._address = address |
| 78 | if not hello: |
| 79 | hello = Hello({}) |
| 80 | |
| 81 | self._server_type = hello.server_type |
| 82 | self._all_hosts = hello.all_hosts |
| 83 | self._tags = hello.tags |
| 84 | self._replica_set_name = hello.replica_set_name |
| 85 | self._primary = hello.primary |
| 86 | self._max_bson_size = hello.max_bson_size |
| 87 | self._max_message_size = hello.max_message_size |
| 88 | self._max_write_batch_size = hello.max_write_batch_size |
| 89 | self._min_wire_version = hello.min_wire_version |
no outgoing calls