MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / __init__

Method __init__

pymongo/synchronous/encryption.py:139–164  ·  view source on GitHub ↗

Internal class to perform I/O on behalf of pymongocrypt.

(
        self,
        client: Optional[MongoClient[_DocumentTypeArg]],
        key_vault_coll: Collection[_DocumentTypeArg],
        mongocryptd_client: Optional[MongoClient[_DocumentTypeArg]],
        opts: AutoEncryptionOpts,
    )

Source from the content-addressed store, hash-verified

137
138class _EncryptionIO(MongoCryptCallback): # type: ignore[misc]
139 def __init__(
140 self,
141 client: Optional[MongoClient[_DocumentTypeArg]],
142 key_vault_coll: Collection[_DocumentTypeArg],
143 mongocryptd_client: Optional[MongoClient[_DocumentTypeArg]],
144 opts: AutoEncryptionOpts,
145 ):
146 """Internal class to perform I/O on behalf of pymongocrypt."""
147 self.client_ref: Any
148 # Use a weak ref to break reference cycle.
149 if client is not None:
150 self.client_ref = weakref.ref(client)
151 else:
152 self.client_ref = None
153 self.key_vault_coll: Optional[Collection[RawBSONDocument]] = cast(
154 Collection[RawBSONDocument],
155 key_vault_coll.with_options(
156 codec_options=_KEY_VAULT_OPTS,
157 read_concern=ReadConcern(level="majority"),
158 write_concern=WriteConcern(w="majority"),
159 ),
160 )
161 self.mongocryptd_client = mongocryptd_client
162 self.opts = opts
163 self._spawned = False
164 self._kms_ssl_contexts = opts._kms_ssl_contexts(_IS_SYNC)
165
166 def kms_request(self, kms_context: MongoCryptKmsContext) -> None:
167 """Complete a KMS request.

Callers

nothing calls this directly

Calls 4

ReadConcernClass · 0.90
WriteConcernClass · 0.90
_kms_ssl_contextsMethod · 0.80
with_optionsMethod · 0.45

Tested by

no test coverage detected