MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / __init__

Method __init__

pymongo/asynchronous/pool.py:125–182  ·  view source on GitHub ↗
(
        self,
        conn: AsyncNetworkingInterface,
        pool: Pool,
        address: tuple[str, int],
        id: int,
        is_sdam: bool,
    )

Source from the content-addressed store, hash-verified

123 """
124
125 def __init__(
126 self,
127 conn: AsyncNetworkingInterface,
128 pool: Pool,
129 address: tuple[str, int],
130 id: int,
131 is_sdam: bool,
132 ):
133 self.pool_ref = weakref.ref(pool)
134 self.conn = conn
135 self.address = address
136 self.id = id
137 self.is_sdam = is_sdam
138 self.closed = False
139 self.last_checkin_time = time.monotonic()
140 self.performed_handshake = False
141 self.is_writable: bool = False
142 self.max_wire_version = MAX_WIRE_VERSION
143 self.max_bson_size = MAX_BSON_SIZE
144 self.max_message_size = MAX_MESSAGE_SIZE
145 self.max_write_batch_size = MAX_WRITE_BATCH_SIZE
146 self.supports_sessions = False
147 self.hello_ok: bool = False
148 self.is_mongos = False
149 self.op_msg_enabled = False
150 self.listeners = pool.opts._event_listeners
151 self.enabled_for_cmap = pool.enabled_for_cmap
152 self.enabled_for_logging = pool.enabled_for_logging
153 self.compression_settings = pool.opts._compression_settings
154 self.compression_context: Union[SnappyContext, ZlibContext, ZstdContext, None] = None
155 self.socket_checker: SocketChecker = SocketChecker()
156 self.oidc_token_gen_id: Optional[int] = None
157 # Support for mechanism negotiation on the initial handshake.
158 self.negotiated_mechs: Optional[list[str]] = None
159 self.auth_ctx: Optional[_AuthContext] = None
160
161 # The pool's generation changes with each reset() so we can close
162 # sockets created before the last reset.
163 self.pool_gen = pool.gen
164 self.generation = self.pool_gen.get_overall()
165 self.ready = False
166 self.cancel_context: _CancellationContext = _CancellationContext()
167 self.opts = pool.opts
168 self.more_to_come: bool = False
169 # For load balancer support.
170 self.service_id: Optional[ObjectId] = None
171 self.server_connection_id: Optional[int] = None
172 # When executing a transaction in load balancing mode, this flag is
173 # set to true to indicate that the session now owns the connection.
174 self.pinned_txn = False
175 self.pinned_cursor = False
176 self.active = False
177 self.last_timeout = self.opts.socket_timeout
178 self.connect_rtt = 0.0
179 self._client_id = pool._client_id
180 self.creation_time = time.monotonic()
181 # For gossiping $clusterTime from the connection handshake to the client.
182 self._cluster_time = None

Callers

nothing calls this directly

Calls 3

SocketCheckerClass · 0.90
get_overallMethod · 0.45

Tested by

no test coverage detected