code
stringlengths
3
6.57k
self._client._return_server_session(self._server_session, lock)
_check_ended(self)
InvalidOperation("Cannot use ended session")
__enter__(self)
__exit__(self, exc_type, exc_val, exc_tb)
self._end_session(lock=True)
client(self)
options(self)
session_id(self)
self._check_ended()
cluster_time(self)
operation_time(self)
_inherit_option(self, name, val)
getattr(txn_opts, name)
getattr(self.client, name)
callback(session)
orders.insert_one({"sku": "abc123", "qty": 100}, session=session)
client.start_session()
session.with_transaction(callback)
callback(session, custom_arg, custom_kwarg=None)
client.start_session()
callback(s, "custom_arg", custom_kwarg=1)
monotonic.time()
callback(self)
self.abort_transaction()
if (isinstance(exc, PyMongoError)
exc.has_error_label("TransientTransactionError")
_within_time_limit(start_time)
self.commit_transaction()
if (exc.has_error_label("UnknownTransactionCommitResult")
_within_time_limit(start_time)
_max_time_expired_error(exc)
if (exc.has_error_label("TransientTransactionError")
_within_time_limit(start_time)
self._check_ended()
InvalidOperation("Transaction already in progress")
self._inherit_option("read_concern", read_concern)
self._inherit_option("write_concern", write_concern)
self._transaction.reset()
self._start_retryable_write()
_TransactionContext(self)
commit_transaction(self)
self._check_ended()
InvalidOperation("No transaction started")
in (_TxnState.STARTING, _TxnState.COMMITTED_EMPTY)
self._finish_transaction_with_retry("commitTransaction", retry)
exc._remove_error_label("TransientTransactionError")
_reraise_with_unknown_commit(exc)
_reraise_with_unknown_commit(exc)
_reraise_with_unknown_commit(exc)
abort_transaction(self)
self._check_ended()
InvalidOperation("No transaction started")
InvalidOperation("Cannot call abortTransaction twice")
in (_TxnState.COMMITTED, _TxnState.COMMITTED_EMPTY)
self._finish_transaction_with_retry("abortTransaction", False)
except (OperationFailure, ConnectionFailure)
_finish_transaction_with_retry(self, command_name, explict_retry)
session.commit_transaction()
self._finish_transaction(command_name, explict_retry)
self._finish_transaction(command_name, True)
self._finish_transaction(command_name, True)
_finish_transaction(self, command_name, retrying)
SON([(command_name, 1)
wc_doc.setdefault("wtimeout", 10000)
WriteConcern(**wc_doc)
self._client._socket_for_writes(self)
_advance_cluster_time(self, cluster_time)
advance_cluster_time(self, cluster_time)
isinstance(cluster_time, abc.Mapping)
isinstance(cluster_time.get("clusterTime")
ValueError("Invalid cluster_time")
self._advance_cluster_time(cluster_time)
_advance_operation_time(self, operation_time)
advance_operation_time(self, operation_time)
isinstance(operation_time, Timestamp)
self._advance_operation_time(operation_time)
_process_response(self, reply)
self._advance_cluster_time(reply.get('$clusterTime')
self._advance_operation_time(reply.get('operationTime')
reply.get('recoveryToken')
has_ended(self)
in_transaction(self)
self._transaction.active()
_pinned_address(self)
self._transaction.active()
_pin_mongos(self, server)
_unpin_mongos(self)
_txn_read_preference(self)
_apply_to(self, command, is_retryable, read_preference)
self._check_ended()
monotonic.time()
self._transaction.reset()
_start_retryable_write(self)
self._check_ended()
self._server_session.inc_transaction_id()
_ServerSession(object)
__init__(self, pool_id)
Binary(uuid.uuid4()
monotonic.time()