mirror of
https://github.com/borgbackup/borg.git
synced 2026-05-28 04:03:21 -04:00
ChunkerParams: add support for buzhash64
This commit is contained in:
parent
dc2dab1535
commit
6f55cba0ce
1 changed files with 15 additions and 0 deletions
|
|
@ -187,6 +187,21 @@ def ChunkerParams(s):
|
|||
return algo, block_size, header_size
|
||||
if algo == "default" and count == 1: # default
|
||||
return CHUNKER_PARAMS
|
||||
if algo == CH_BUZHASH64 and count == 5: # buzhash64, chunk_min, chunk_max, chunk_mask, window_size
|
||||
chunk_min, chunk_max, chunk_mask, window_size = (int(p) for p in params[1:])
|
||||
if not (chunk_min <= chunk_mask <= chunk_max):
|
||||
raise argparse.ArgumentTypeError("required: chunk_min <= chunk_mask <= chunk_max")
|
||||
if chunk_min < 6:
|
||||
# see comment in 'fixed' algo check
|
||||
raise argparse.ArgumentTypeError(
|
||||
"min. chunk size exponent must not be less than 6 (2^6 = 64B min. chunk size)"
|
||||
)
|
||||
if chunk_max > 23:
|
||||
raise argparse.ArgumentTypeError(
|
||||
"max. chunk size exponent must not be more than 23 (2^23 = 8MiB max. chunk size)"
|
||||
)
|
||||
# note that for buzhash64, there is no problem with even window_size.
|
||||
return CH_BUZHASH64, chunk_min, chunk_max, chunk_mask, window_size
|
||||
# this must stay last as it deals with old-style compat mode (no algorithm, 4 params, buzhash):
|
||||
if algo == CH_BUZHASH and count == 5 or count == 4: # [buzhash, ]chunk_min, chunk_max, chunk_mask, window_size
|
||||
chunk_min, chunk_max, chunk_mask, window_size = (int(p) for p in params[count - 4 :])
|
||||
|
|
|
|||
Loading…
Reference in a new issue