1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-22 14:11:27 +00:00

Count non-unique chunks deduplicated sizes

This commit is contained in:
Abogical 2017-02-17 17:26:02 +02:00
parent 59571115a1
commit 6ed0746934

View file

@ -19,7 +19,7 @@
import unicodedata
import uuid
from binascii import hexlify
from collections import namedtuple, deque, abc
from collections import namedtuple, deque, abc, Counter
from datetime import datetime, timezone, timedelta
from fnmatch import translate
from functools import wraps, partial, lru_cache
@ -1546,11 +1546,15 @@ def calculate_csize(self, item):
def calculate_dsize(self, item):
chunk_index = self.archive.cache.chunks
return sum(c.size for c in item.get('chunks', []) if chunk_index[c.id].refcount == 1)
chunks = item.get('chunks', [])
chunks_counter = Counter(c.id for c in chunks)
return sum(c.size for c in chunks if chunk_index[c.id].refcount == chunks_counter[c.id])
def calculate_dcsize(self, item):
chunk_index = self.archive.cache.chunks
return sum(c.csize for c in item.get('chunks', []) if chunk_index[c.id].refcount == 1)
chunks = item.get('chunks', [])
chunks_counter = Counter(c.id for c in chunks)
return sum(c.csize for c in chunks if chunk_index[c.id].refcount == chunks_counter[c.id])
def hash_item(self, hash_function, item):
if 'chunks' not in item: