%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/dns/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/dns/__pycache__/versioned.cpython-312.pyc

�

5��e�-���dZddlZddlZddlmZmZmZmZmZddl	Z
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
Gd�de
j&j(�Ze
j,j.Ze
j,j2Ze
j,j6Ze
j,j8Ze
j,j:Ze
j,j<ZGd�de
j,j>�Zy)zDNS Versioned Zones.�N)�Callable�Deque�Optional�Set�Unionc��eZdZdZy)�UseTransactionz-To alter a versioned zone, use a transaction.N)�__name__�
__module__�__qualname__�__doc__���//usr/lib/python3/dist-packages/dns/versioned.pyr	r	s��7rr	c
���eZdZgd�ZeZejjddfde	e
ejje
fdejjdede	edege	eff�fd�
Z	d'd	e	ed
e	edefd�Zd(dedefd�Zd�Zd�Zd�Zde	eddfd�Zde	edege	efddfd�Zd�Zd�Zd�Zd�Zd�Z d�Z!	d(de
ejje
fdedejDjf�fd�
Z#de
ejje
fddfd �Z$ejJjLd
fde
ejje
fd!e
ejJjNe
fd"e
ejJjNe
fdedejPjRf
�fd#�
Z*ejJjLd
fde
ejje
fd!e
ejJjNe
fd"e
ejJjNe
fdede	ejPjRf
�fd$�
Z+ejJjLfde
ejje
fd!e
ejJjNe
fd"e
ejJjNe
fddfd%�Z,de
ejje
fdejPjRddfd&�Z-�xZ.S))�Zone)�	_versions�_versions_lock�
_write_txn�_write_waiters�_write_event�_pruning_policy�_readersTN�origin�rdclass�
relativize�pruning_policyc�j��t�|�|||�tj�|_tj�|_|�|j|_	n||_	d|_
d|_tj�|_t�|_|jdt!|d��|�y)a�Initialize a versioned zone object.

        *origin* is the origin of the zone.  It may be a ``dns.name.Name``,
        a ``str``, or ``None``.  If ``None``, then the zone's origin will
        be set by the first ``$ORIGIN`` line in a zone file.

        *rdclass*, an ``int``, the zone's rdata class; the default is class IN.

        *relativize*, a ``bool``, determine's whether domain names are
        relativized to the zone's origin.  The default is ``True``.

        *pruning policy*, a function taking a ``Zone`` and a ``Version`` and returning
        a ``bool``, or ``None``.  Should the version be pruned?  If ``None``,
        the default policy, which retains one version is used.
        NT)�replacement)�super�__init__�collections�dequer�	threading�Lock�
_version_lock�_default_pruning_policyrrrr�setr�_commit_version_unlocked�WritableVersion)�selfrrrr�	__class__s     �rr!z
Zone.__init__.s����,	�����*�5�)4�):�):�)<���&�^�^�-����!�#'�#?�#?�D� �#1�D� �15���7;���6A�6G�6G�6I���*-�%��
��%�%��/�$�D�9�6�	
r�id�serial�returnc��|�
|�td��|j5|�<d}t|j�D]}|j|k(s�|}n|��td��|��|jrtjj}n|j�J�|j}d}t|j�D]m}|jj|�}|s�!|j|jtjj �}|s�X|dj"|k(s�k|}n|�td��|jd}t%|d|�}|j&j)|�|cddd�S#1swYyxYw)Nz!cannot specify both id and serialzversion not foundrzserial not found���F)�
ValueErrorr&�reversedrr-�KeyErrorr�dns�name�emptyr�nodes�get�get_rdatasetr�	rdatatype�SOAr.�Transactionr�add)	r+r-r.�version�v�oname�n�rds�txns	         r�readerzZone.readerSsa���>�f�0��@�A�A�
�
�
�	��~���!�$�.�.�1��A��t�t�r�z�"#�����?�"�#6�7�7��#��?�?��H�H�N�N�E��;�;�2�2�2� �K�K�E���!�$�.�.�1�"�A������E�*�A���n�n�T�\�\�3�=�=�;L�;L�M���3�q�6�=�=�F�#:�&'�G�!�
"��?�"�#5�6�6��.�.��,���d�E�7�3�C��M�M���c�"��;	�	�	�s%�,E4�	BE4�6E4�
E4� A
E4�4E=Frc��d}	|j5|j�3||jk(r$t||d��|_d|_	ddd�nHt	j
�}|jj|�ddd�|j���|jj�|jS#1swY�@xYw)NT)�make_immutable)
r&rrr=r$�Eventr�append�wait�_setup_version)r+r�events   r�writerzZone.writerws�������#�#�
2�
�?�?�*�u��8I�8I�/I�'2��k�$�'�D�O�)-�D�%��!
2�
2�("���)���#�#�*�*�5�1�+
2�R
�J�J�L�U�X	
���&�&�(�����Y
2�
2�s�7B>�/B>�>Cc��t|j�dkDr:|jj�|_|jj	�yy)Nr)�lenr�popleftrr()r+s r�!_maybe_wakeup_one_waiter_unlockedz&Zone._maybe_wakeup_one_waiter_unlocked�sC���t�"�"�#�a�'� $� 3� 3� ;� ;� =�D�����!�!�#�(rc��y)NTr)r+�zoner?s   rr'zZone._default_pruning_policy�s��rc��t|j�dkDsJ�t|j�dkDrtd�|jD��}n|jdj}|jdj|krx|j||jd�rX|jj
�|jdj|kr!|j||jd�r�Vyyyy)Nrc3�HK�|]}|jj���y�w�N)r?r-)�.0rDs  r�	<genexpr>z0Zone._prune_versions_unlocked.<locals>.<genexpr>�s����E��S�[�[�^�^�E�s� "r1)rOrr�minr-rrP)r+�
least_kepts  r�_prune_versions_unlockedzZone._prune_versions_unlocked�s����4�>�>�"�Q�&�&�&��t�}�}���!��E�t�}�}�E�E�J�����+�.�.�J��n�n�Q��"�"�Z�/�D�4H�4H��$�.�.��#�5
�
�N�N�"�"�$��n�n�Q��"�"�Z�/�D�4H�4H��$�.�.��#�5
�/�5
�/r�max_versionsc�b�����dkrtd����d�}n�fd�}|j|�y)zYSet a pruning policy that retains up to the specified number
        of versions
        N�zmax versions must be at least 1c��y)NFr)rS�_s  r�policyz%Zone.set_max_versions.<locals>.policy�s��rc�4��t|j��kDSrV)rOr)rSr`r\s  �rraz%Zone.set_max_versions.<locals>.policy�s����4�>�>�*�\�9�9r)r2�set_pruning_policy)r+r\ras ` r�set_max_versionszZone.set_max_versions�s>����#��q�(8��>�?�?���
�

:�	
����'rrac��|�|j}|j5||_|j�ddd�y#1swYyxYw)a�Set the pruning policy for the zone.

        The *policy* function takes a `Version` and returns `True` if
        the version should be pruned, and `False` otherwise.  `None`
        may also be specified for policy, in which case the default policy
        is used.

        Pruning checking proceeds from the least version and the first
        time the function returns `False`, the checking stops.  I.e. the
        retained versions are always a consecutive sequence.
        N)r'r&rr[)r+ras  rrczZone.set_pruning_policy�sF���>��1�1�F�
�
�
�	,�#)�D� ��)�)�+�	,�	,�	,�s	�<�Ac��|j5|jj|�|j�ddd�y#1swYyxYwrV)r&r�remover[�r+rDs  r�	_end_readzZone._end_read�s>��
�
�
�	,��M�M� � ��%��)�)�+�	,�	,�	,�s�,A�Ac�T�|j|k(sJ�d|_|j�yrV)rrQrhs  r�_end_write_unlockedzZone._end_write_unlocked�s'�����#�%�%�%�����.�.�0rc�h�|j5|j|�ddd�y#1swYyxYwrV)r&rkrhs  r�
_end_writezZone._end_write�s.��
�
�
�	*��$�$�S�)�	*�	*�	*�s�(�1c���|jj|�|j�|j|_|j�||_|�|j|�yyrV)rrIr[r8rrk�r+rDr?rs    rr)zZone._commit_version_unlocked�sT�������g�&��%�%�'��]�]��
��;�;�� �D�K��?��$�$�S�)�rc�l�|j5|j|||�ddd�y#1swYyxYwrV)r&r)ros    r�_commit_versionzZone._commit_versions6��
�
�
�	@��)�)�#�w��?�	@�	@�	@�s�*�3c�v�t|j�dkDr|jdjdz}|Sd}|S)Nrr1r^)rOrr-)r+r-s  r�_get_next_version_idzZone._get_next_version_ids?���t�~�~���"�����#�&�&��*�B��	��B��	rr6�createc�2��|rt�t�|�	|�SrV)r	r �	find_node)r+r6rtr,s   �rrvzZone.find_nodes���� � ��w� ��&�&rc��t�rV�r	)r+r6s  r�delete_nodezZone.delete_nodes���r�rdtype�coversc�t��|rt�t�|�	|||�}tjj|�SrV)r	r �
find_rdatasetr5�rdataset�ImmutableRdataset�r+r6rzr{rtr~r,s      �rr}zZone.find_rdatasets6���� � ��7�(��v�v�>���|�|�-�-�h�7�7rc�z��|rt�t�|�	|||�}|�tjj|�SyrV)r	r r:r5r~rr�s      �rr:zZone.get_rdataset$s?���� � ��7�'��f�f�=�����<�<�1�1�(�;�;�rc��t�rVrx)r+r6rzr{s    r�delete_rdatasetzZone.delete_rdataset3s
���rc��t�rVrx)r+r6rs   r�replace_rdatasetzZone.replace_rdataset;s
���r)NN)F)/r
rr�	__slots__�Node�node_factoryr5�
rdataclass�INrrr6�Name�str�
RdataClass�boolr�Versionr!�intr=rErMrQr'r[rdrcrirkrmr)rqrs�nodervryr;�NONE�	RdataTyper~�Rdatasetr}r:r�r��
__classcell__)r,s@rrr!sh����I��L�
.1�^�^�->�->��PT�#
���s�x�x�}�}�c�1�2�3�#
����*�*�#
��	#
�
!��6�7�*;�X�d�^�*K�!L�M�#
�LAE�"��3�-�"�08��
�"�	�"�H/�$�/�;�/�b$��
%�$(�X�c�]�(�t�(�$,��x���(9�8�D�>�(I�J�K�,�	
�,�(,�
1�
*�*�@��?D�'��#�(�(�-�-��,�-�'�7;�'�	�����'���c�h�h�m�m�S�&8� 9��d��7:�m�m�6H�6H��
8��C�H�H�M�M�3�&�'�
8��c�m�m�-�-�s�2�3�
8��c�m�m�-�-�s�2�3�	
8�
�
8�

���	�	�
8� 7:�m�m�6H�6H��
��C�H�H�M�M�3�&�'�
��c�m�m�-�-�s�2�3�
��c�m�m�-�-�s�2�3�	
�
�
�
�#�,�,�'�'�	(�

�&7:�m�m�6H�6H�	��C�H�H�M�M�3�&�'���c�m�m�-�-�s�2�3���c�m�m�-�-�s�2�3�	�

����#�(�(�-�-��,�-��<?�L�L�<Q�<Q��	
�rr) r
r"r$�typingrrrrr�
dns.exceptionr5�
dns.immutable�dns.name�dns.node�dns.rdataclass�dns.rdataset�
dns.rdatatype�dns.rdtypes.ANY.SOA�dns.zone�	exception�DNSExceptionr	rS�
VersionedNoder��ImmutableVersionedNode�
ImmutableNoder�r*�ImmutableVersionr=rrrr�<module>r�s������8�8����������8�S�]�]�/�/�8�
�x�x�������/�/�
�

�(�(�
�
���(�(�*�*���8�8�,�,���h�h�"�"��]�3�8�8�=�=�]r

Zerion Mini Shell 1.0