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

Method load

src/borg/cache.py:274–298  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

272 self.load()
273
274 def load(self):
275 self._config = configparser.ConfigParser(interpolation=None)
276 with self.config_path.open() as fd:
277 self._config.read_file(fd)
278 self._check_upgrade(self.config_path)
279 self.id = self._config.get("cache", "repository")
280 self.manifest_id = hex_to_bin(self._config.get("cache", "manifest"))
281 self.ignored_features = set(parse_stringified_list(self._config.get("cache", "ignored_features", fallback="")))
282 self.mandatory_features = set(
283 parse_stringified_list(self._config.get("cache", "mandatory_features", fallback=""))
284 )
285 try:
286 self.integrity = dict(self._config.items("integrity"))
287 if self._config.get("cache", "manifest") != self.integrity.pop("manifest"):
288 # The cache config file is updated (parsed with ConfigParser, the state of the ConfigParser
289 # is modified and then written out.), not re-created.
290 # Thus, older versions will leave our [integrity] section alone, making the section's data invalid.
291 # Therefore, we also add the manifest ID to this section and
292 # can discern whether an older version interfered by comparing the manifest IDs of this section
293 # and the main [cache] section.
294 self.integrity = {}
295 logger.warning("Cache integrity data not available: old Borg version modified the cache.")
296 except configparser.NoSectionError:
297 logger.debug("Cache integrity: No integrity data found (files, chunks). Cache is from old version.")
298 self.integrity = {}
299
300 def save(self, manifest=None):
301 if manifest:

Callers 2

openMethod · 0.95
openMethod · 0.45

Calls 8

_check_upgradeMethod · 0.95
hex_to_binFunction · 0.85
parse_stringified_listFunction · 0.85
warningMethod · 0.80
debugMethod · 0.80
openMethod · 0.45
getMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected