MCPcopy
hub / github.com/borgbackup/borg / __init__

Method __init__

src/borg/cache.py:946–989  ·  view source on GitHub ↗

:param warn_if_unencrypted: print warning if accessing unknown unencrypted repository :param cache_mode: what shall be compared in the file stat infos vs. cached stat infos comparison

(
        self,
        manifest,
        path=None,
        warn_if_unencrypted=True,
        progress=False,
        cache_mode=FILES_CACHE_MODE_DISABLED,
        iec=False,
        archive_name=None,
        start_backup=None,
    )

Source from the content-addressed store, hash-verified

944 """
945
946 def __init__(
947 self,
948 manifest,
949 path=None,
950 warn_if_unencrypted=True,
951 progress=False,
952 cache_mode=FILES_CACHE_MODE_DISABLED,
953 iec=False,
954 archive_name=None,
955 start_backup=None,
956 ):
957 """
958 :param warn_if_unencrypted: print warning if accessing unknown unencrypted repository
959 :param cache_mode: what shall be compared in the file stat infos vs. cached stat infos comparison
960 """
961 FilesCacheMixin.__init__(self, cache_mode, archive_name, start_backup)
962 ChunksMixin.__init__(self)
963 assert isinstance(manifest, Manifest)
964 self.manifest = manifest
965 self.repository = manifest.repository
966 self.key = manifest.key
967 self.repo_objs = manifest.repo_objs
968 self.progress = progress
969
970 self.path = cache_dir(self.repository, path)
971 self.security_manager = SecurityManager(self.repository)
972 self.cache_config = CacheConfig(self.repository, self.path)
973
974 # Warn user before sending data to a never seen before unencrypted repository
975 if not self.path.exists():
976 self.security_manager.assert_access_unknown(warn_if_unencrypted, manifest, self.key)
977 self.create()
978
979 self.open()
980 try:
981 self.security_manager.assert_secure(manifest, self.key)
982
983 if not self.check_cache_compatibility():
984 self.wipe_cache()
985
986 self.update_compatibility()
987 except: # noqa
988 self.close()
989 raise
990
991 def __enter__(self):
992 self._chunks = None

Callers

nothing calls this directly

Calls 13

createMethod · 0.95
openMethod · 0.95
wipe_cacheMethod · 0.95
update_compatibilityMethod · 0.95
closeMethod · 0.95
cache_dirFunction · 0.85
SecurityManagerClass · 0.85
CacheConfigClass · 0.85
assert_access_unknownMethod · 0.80
assert_secureMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected