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

Function read_chunkindex_from_repo_cache

src/borg/cache.py:782–796  ·  view source on GitHub ↗
(repository, hash)

Source from the content-addressed store, hash-verified

780
781
782def read_chunkindex_from_repo_cache(repository, hash):
783 cache_name = f"cache/chunks.{hash}"
784 logger.debug(f"trying to load {cache_name} from the repo...")
785 try:
786 chunks_data = repository.store_load(cache_name)
787 except StoreObjectNotFound:
788 logger.debug(f"{cache_name} not found in the repository.")
789 else:
790 if xxh64(chunks_data, seed=CHUNKINDEX_HASH_SEED).digest() == hex_to_bin(hash):
791 logger.debug(f"{cache_name} is valid.")
792 with io.BytesIO(chunks_data) as f:
793 chunks = ChunkIndex.read(f)
794 return chunks
795 else:
796 logger.debug(f"{cache_name} is invalid.")
797
798
799def build_chunkindex_from_repo(repository, *, disable_caches=False, cache_immediately=False):

Calls 5

hex_to_binFunction · 0.85
debugMethod · 0.80
digestMethod · 0.80
store_loadMethod · 0.45
readMethod · 0.45