mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-24 15:12:00 +00:00
remove csize support from get_size
This commit is contained in:
parent
ace5957524
commit
b726aa5665
3 changed files with 4 additions and 9 deletions
|
@ -1805,7 +1805,7 @@ def replacement_chunk(size):
|
|||
item.chunks = chunk_list
|
||||
if 'size' in item:
|
||||
item_size = item.size
|
||||
item_chunks_size = item.get_size(compressed=False, from_chunks=True)
|
||||
item_chunks_size = item.get_size(from_chunks=True)
|
||||
if item_size != item_chunks_size:
|
||||
# just warn, but keep the inconsistency, so that borg extract can warn about it.
|
||||
logger.warning('{}: {}: size inconsistency detected: size {}, chunks size {}'.format(
|
||||
|
|
|
@ -840,7 +840,7 @@ def calculate_num_chunks(self, item):
|
|||
|
||||
def calculate_size(self, item):
|
||||
# note: does not support hardlink slaves, they will be size 0
|
||||
return item.get_size(compressed=False)
|
||||
return item.get_size()
|
||||
|
||||
def hash_item(self, hash_function, item):
|
||||
if 'chunks' not in item:
|
||||
|
|
|
@ -284,17 +284,14 @@ class Item(PropDict):
|
|||
|
||||
part = PropDict._make_property('part', int)
|
||||
|
||||
def get_size(self, memorize=False, compressed=False, from_chunks=False, consider_ids=None):
|
||||
def get_size(self, *, memorize=False, from_chunks=False, consider_ids=None):
|
||||
"""
|
||||
Determine the (uncompressed or compressed) size of this item.
|
||||
Determine the uncompressed size of this item.
|
||||
|
||||
:param memorize: Whether the computed size value will be stored into the item.
|
||||
:param compressed: Whether the compressed or uncompressed size will be returned.
|
||||
:param from_chunks: If true, size is computed from chunks even if a precomputed value is available.
|
||||
:param consider_ids: Returns the size of the given ids only.
|
||||
"""
|
||||
if compressed:
|
||||
return 0 # try to live without csize
|
||||
attr = 'size'
|
||||
assert not (consider_ids is not None and memorize), "Can't store size when considering only certain ids"
|
||||
try:
|
||||
|
@ -497,10 +494,8 @@ class ArchiveItem(PropDict):
|
|||
recreate_args = PropDict._make_property('recreate_args', list) # list of s-e-str
|
||||
recreate_partial_chunks = PropDict._make_property('recreate_partial_chunks', list) # list of tuples
|
||||
size = PropDict._make_property('size', int)
|
||||
csize = PropDict._make_property('csize', int)
|
||||
nfiles = PropDict._make_property('nfiles', int)
|
||||
size_parts = PropDict._make_property('size_parts', int)
|
||||
csize_parts = PropDict._make_property('csize_parts', int)
|
||||
nfiles_parts = PropDict._make_property('nfiles_parts', int)
|
||||
|
||||
def update_internal(self, d):
|
||||
|
|
Loading…
Reference in a new issue