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:
parent
59571115a1
commit
6ed0746934
1 changed files with 7 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue