관리-도구
편집 파일: versioned.cpython-38.pyc
U /?�f�- � @ s� d Z ddlZddlZddlmZmZmZmZmZ ddl Z ddlZ ddlZ ddl Z ddlZ ddlZ ddlZ ddlZ ddlZ G dd� de jj�Ze jjZe jjZe jjZe jjZe jjZe jjZG dd� de jj�ZdS )zDNS Versioned Zones.� N)�Callable�Deque�Optional�Set�Unionc @ s e Zd ZdZdS )�UseTransactionz-To alter a versioned zone, use a transaction.N)�__name__� __module__�__qualname__�__doc__� r r �;/opt/hc_python/lib/python3.8/site-packages/dns/versioned.pyr s r c sb e Zd ZdddddddgZeZejjdd fe e ejje f ejjee ed ege e f d �� fdd� Zd=e e e e ed �dd�Zd>eed�dd�Zdd� Zdd� Zdd� Ze e d d�dd�Ze ed ege e f d d�dd�Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Z d*d+� Z!d?e ejje f eej"jd,�� fd-d.� Z#e ejje f d d/�d0d1�Z$ej%j&dfe ejje f e ej%j'e f e ej%j'e f eej(j)d2�� fd3d4� Z*ej%j&dfe ejje f e ej%j'e f e ej%j'e f ee ej(j) d2�� fd5d6� Z+ej%j&fe ejje f e ej%j'e f e ej%j'e f d d7�d8d9�Z,e ejje f ej(j)d d:�d;d<�Z-� Z.S )@�Zone� _versionsZ_versions_lock� _write_txn�_write_waiters�_write_event�_pruning_policy�_readersTN)�origin�rdclass� relativize�pruning_policyc st t � �|||� t�� | _t�� | _|dkr6| j| _ n|| _ d| _ d| _t�� | _t � | _| �dt| dd�|� dS )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_policyr r r r �setr �_commit_version_unlocked�WritableVersion)�selfr r r r �� __class__r r r . s �z Zone.__init__)�id�serial�returnc C s, |d k r|d k rt d��| j�� |d k rbd }t| j�D ]}|j|kr8|} qPq8|d kr�td��n�|d k r�| jrztjj }n| j d k s�t�| j }d }t| j�D ]@}|j� |�}|r�|�| jtjj�}|r�|d j|kr�|} q�q�|d kr�td��n | jd }t| d|�}| j�|� |W 5 Q R � S Q R X d S )Nz!cannot specify both id and serialzversion not foundr zserial not found���F)� ValueErrorr �reversedr r( �KeyErrorr �dns�name�emptyr �AssertionError�nodes�get�get_rdatasetr � rdatatypeZSOAr) �Transactionr �add) r% r( r) �version�vZoname�nZrds�txnr r r �readerS s<