+\h7^dZddlmZddlmZmZmZddlmZd dZ GddZ e Z y) zTools for working with write concerns. .. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs. ) annotations)AnyOptionalUnion)ConfigurationErrorcLt|tr|St|d|d|)z(Validates that 'value' is True or False.z must be True or False, was: =) isinstancebool TypeError)optionvalues X/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pymongo/write_concern.pyvalidate_booleanrs.% vh;F81UGL MMceZdZdZdZ d d dZed dZeddZed dZ ddZ dd Z dd Z y) WriteConcernaWriteConcern :param w: (integer or string) Used with replication, write operations will block until they have been replicated to the specified number or tagged set of servers. `w=` always includes the replica set primary (e.g. w=3 means write to the primary and wait until replicated to **two** secondaries). **w=0 disables acknowledgement of write operations and can not be used with other write concern options.** :param wtimeout: (integer) **DEPRECATED** Used in conjunction with `w`. Specify a value in milliseconds to control how long to wait for write propagation to complete. If replication does not complete in the given timeframe, a timeout exception is raised. :param j: If ``True`` block until write operations have been committed to the journal. Cannot be used in combination with `fsync`. Write operations will fail with an exception if this option is used when the server is running without journaling. :param fsync: If ``True`` and the server is running without journaling, blocks until the server has synced all data files to disk. If the server is running with journaling, this acts the same as the `j` option, blocking until write operations have been committed to the journal. Cannot be used in combination with `j`. .. versionchanged:: 4.7 Deprecated parameter ``wtimeout``, use :meth:`~pymongo.timeout`. ) __document__acknowledged__server_defaultNcTi|_d|_|Ft|tst dt ||dkr t d||jd<|td|||jd<|*td||r |r td||jd<|dk(r|dur td |at|tr|dkr t d |dkD|_n't|tst d t |||jd <|j |_ y) NTz!wtimeout must be an integer, not rzwtimeout cannot be less than 0wtimeoutjfsyncz+Can't set both j and fsync at the same timezCannot set w to 0 and j to Truezw cannot be less than 0z$w must be an integer or string, not w) _WriteConcern__document_WriteConcern__acknowledgedr intr type ValueErrorrrstr_WriteConcern__server_default)selfrrrrs r__init__zWriteConcern.__init__As-+-"  h,"CDNCS TUU!| !ABB*2DOOJ ' = S! $#$DOOC   We ,U()VWW',DOOG $ 6a4i$%FG G =!S!q5$%>??&'!e#3'"FtAwi PQQ#$DOOC $(OO 3rc|jS)z0Does this WriteConcern match the server default.)r"r#s ris_server_defaultzWriteConcern.is_server_defaultjs$$$rc6|jjS)zThe document representation of this write concern. .. note:: :class:`WriteConcern` is immutable. Mutating the value of :attr:`document` does not mutate this :class:`WriteConcern`. )rcopyr&s rdocumentzWriteConcern.documentos##%%rc|jS)z]If ``True`` write operations will wait for acknowledgement before returning. )rr&s r acknowledgedzWriteConcern.acknowledgedys """rcdjdjd|jjDS)NzWriteConcern({})z, c30K|]\}}|d|yw)r N).0kvs r z(WriteConcern.__repr__..sGtq!1QElGs)formatjoinritemsr&s r__repr__zWriteConcern.__repr__s4!(( IIGt/D/D/FG G  rc`t|tr|j|jk(StSNr rrr*NotImplementedr#others r__eq__zWriteConcern.__eq__% e\ *??enn4 4rc`t|tr|j|jk7StSr9r:r<s r__ne__zWriteConcern.__ne__r?r)NNNN) rzOptional[Union[int, str]]rz Optional[int]rOptional[bool]rrBreturnNone)rCr )rCzdict[str, Any])rCr!)r=rrCr ) __name__ __module__ __qualname____doc__ __slots__r$propertyr'r*r,r7r>rAr/rrrr"s8EI(,"& $ '4 $'4 '4  '4  '4  '4R%%&&##   rrN)r r!rrrCr ) rH __future__rtypingrrrpymongo.errorsrrrDEFAULT_WRITE_CONCERNr/rrrOs5#''-Nkk\%r