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,
)
| 137 | |
| 138 | class _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. |
nothing calls this directly
no test coverage detected