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

Method hash_item

src/borg/helpers/parseformat.py:1104–1113  ·  view source on GitHub ↗
(self, hash_function, item)

Source from the content-addressed store, hash-verified

1102 return f"{self.conditions_hash[:16]}-{chunks_hash}"
1103
1104 def hash_item(self, hash_function, item):
1105 if "chunks" not in item:
1106 return ""
1107 if hash_function == "xxh64":
1108 hash = self.xxh64()
1109 elif hash_function in self.hash_algorithms:
1110 hash = hashlib.new(hash_function)
1111 for data in self.archive.pipeline.fetch_many(item.chunks, ro_type=ROBJ_FILE_STREAM):
1112 hash.update(data)
1113 return hash.hexdigest()
1114
1115 def format_time(self, key, item):
1116 return OutputTimestamp(safe_timestamp(item.get(key) or item.mtime))

Callers

nothing calls this directly

Calls 4

newMethod · 0.80
fetch_manyMethod · 0.80
hexdigestMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected