Current File : //usr/lib64/python3.6/site-packages/borg/__pycache__/cache.cpython-36.pyc |
3
up�dC� � @ s* d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm Z ddl
mZ e� Z
ed�Zddl
mZmZ dd lmZmZmZ dd
lmZ ddlmZ ddlmZ dd
lmZmZ ddlmZmZmZmZ ddlmZ ddlmZ ddlm Z m!Z! ddlm"Z" ddlm#Z#m$Z$ ddlm%Z%m&Z& ddlm'Z' ddlm(Z( ddl)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9 edd�Z:G d d!� d!�Z;d"d#� Z<d$d%� Z=d6d&d'�Z>d(d)� Z?d*d+� Z@G d,d-� d-�ZAG d.d/� d/�ZBG d0d1� d1�ZCG d2d3� d3eC�ZDG d4d5� d5eC�ZEdS )7� N)� unhexlify)�
namedtuple)�perf_counter� )�
create_loggerzborg.debug.files_cache)�CACHE_README�FILES_CACHE_MODE_DISABLED)�
ChunkIndex�ChunkIndexEntry�CacheSynchronizer)�Location)�Error)�Manifest)�
get_cache_dir�get_security_dir)�
int_to_bigint�
bigint_to_int�
bin_to_hex�parse_stringified_list)�format_file_size)�safe_ns)�yes�hostname_is_unique)�remove_surrogates)�ProgressIndicatorPercent�ProgressIndicatorMessage)�set_ec�EXIT_WARNING)�safe_unlink)�msgpack)�ArchiveItem�ChunkListEntry)�PlaintextKey)�IntegrityCheckedFile�DetachedIntegrityCheckedFile�FileIntegrityError)�Lock)�SaveFile)�cache_if_remote)�LIST_SCAN_LIMIT�FileCacheEntryzage inode size cmtime chunk_idsc @ s� e Zd ZdZdd� Zeddd��Zdd� Zd d
� Zdd� Z dd
d�Z
ddd�Zddd�Zdddd�dd�Z
ddd�Zdd� ZdS ) �SecurityManageras
Tracks repositories. Ensures that nothing bad happens (repository swaps,
replay attacks, unknown repositories etc.).
This is complicated by the Cache being initially used for this, while
only some commands actually use the Cache, which meant that other commands
did not perform these checks.
Further complications were created by the Cache being a cache, so it
could be legitimately deleted, which is annoying because Borg didn't
recognize repositories after that.
Therefore a second location, the security database (see get_security_dir),
was introduced which stores this information. However, this means that
the code has to deal with a cache existing but no security DB entry,
or inconsistencies between the security DB and the cache which have to
be reconciled, and also with no cache existing but a security DB entry.
c C sV || _ t|j�| _t|�| _tjj| jd�| _tjj| jd�| _ tjj| jd�| _
d S )Nzkey-type�locationzmanifest-timestamp)�
repositoryr �id_str�dir� cache_dir�os�path�join�
key_type_file�
location_file�manifest_ts_file)�selfr- � r8 �/usr/lib64/python3.6/cache.py�__init__>