|
@@ -14,6 +14,7 @@ import traceback
|
|
|
|
|
|
from . import __version__
|
|
from . import __version__
|
|
from .archive import Archive, ArchiveChecker, CHUNKER_PARAMS
|
|
from .archive import Archive, ArchiveChecker, CHUNKER_PARAMS
|
|
|
|
+from .compress import Compressor, COMPR_BUFFER
|
|
from .repository import Repository
|
|
from .repository import Repository
|
|
from .cache import Cache
|
|
from .cache import Cache
|
|
from .key import key_creator
|
|
from .key import key_creator
|
|
@@ -21,7 +22,7 @@ from .helpers import Error, location_validator, format_time, format_file_size, \
|
|
format_file_mode, ExcludePattern, exclude_path, adjust_patterns, to_localtime, timestamp, \
|
|
format_file_mode, ExcludePattern, exclude_path, adjust_patterns, to_localtime, timestamp, \
|
|
get_cache_dir, get_keys_dir, format_timedelta, prune_within, prune_split, \
|
|
get_cache_dir, get_keys_dir, format_timedelta, prune_within, prune_split, \
|
|
Manifest, remove_surrogates, update_excludes, format_archive, check_extension_modules, Statistics, \
|
|
Manifest, remove_surrogates, update_excludes, format_archive, check_extension_modules, Statistics, \
|
|
- is_cachedir, bigint_to_int, ChunkerParams
|
|
|
|
|
|
+ is_cachedir, bigint_to_int, ChunkerParams, CompressionSpec
|
|
from .remote import RepositoryServer, RemoteRepository
|
|
from .remote import RepositoryServer, RemoteRepository
|
|
|
|
|
|
|
|
|
|
@@ -101,7 +102,9 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
|
|
t0 = datetime.now()
|
|
t0 = datetime.now()
|
|
repository = self.open_repository(args.archive, exclusive=True)
|
|
repository = self.open_repository(args.archive, exclusive=True)
|
|
manifest, key = Manifest.load(repository)
|
|
manifest, key = Manifest.load(repository)
|
|
- key.compression_level = args.compression
|
|
|
|
|
|
+ compr_args = dict(buffer=COMPR_BUFFER)
|
|
|
|
+ compr_args.update(args.compression)
|
|
|
|
+ key.compressor = Compressor(**compr_args)
|
|
cache = Cache(repository, key, manifest, do_files=args.cache_files)
|
|
cache = Cache(repository, key, manifest, do_files=args.cache_files)
|
|
archive = Archive(repository, key, manifest, args.archive.archive, cache=cache,
|
|
archive = Archive(repository, key, manifest, args.archive.archive, cache=cache,
|
|
create=True, checkpoint_interval=args.checkpoint_interval,
|
|
create=True, checkpoint_interval=args.checkpoint_interval,
|
|
@@ -634,9 +637,16 @@ Type "Yes I am sure" if you understand this and want to continue.\n""")
|
|
metavar='CHUNK_MIN_EXP,CHUNK_MAX_EXP,HASH_MASK_BITS,HASH_WINDOW_SIZE',
|
|
metavar='CHUNK_MIN_EXP,CHUNK_MAX_EXP,HASH_MASK_BITS,HASH_WINDOW_SIZE',
|
|
help='specify the chunker parameters. default: %d,%d,%d,%d' % CHUNKER_PARAMS)
|
|
help='specify the chunker parameters. default: %d,%d,%d,%d' % CHUNKER_PARAMS)
|
|
subparser.add_argument('-C', '--compression', dest='compression',
|
|
subparser.add_argument('-C', '--compression', dest='compression',
|
|
- type=int, default=0, metavar='N',
|
|
|
|
- help='select compression algorithm and level. 0..9 is supported and means zlib '
|
|
|
|
- 'level 0 (no compression, fast, default) .. zlib level 9 (high compression, slow).')
|
|
|
|
|
|
+ type=CompressionSpec, default=dict(name='null'), metavar='COMPRESSION',
|
|
|
|
+ help='select compression algorithm and level, by giving a number: '
|
|
|
|
+ '0 == no compression [default], '
|
|
|
|
+ '1..9 == zlib level 1..9, '
|
|
|
|
+ '10 == lz4. '
|
|
|
|
+ 'Alternatively, you can also give a name and optionally additional args: '
|
|
|
|
+ 'null == no compression, '
|
|
|
|
+ 'zlib == zlib (default level 6), '
|
|
|
|
+ 'zlib,0 .. zlib,9 == zlib (with level 0..9), '
|
|
|
|
+ 'lz4 == lz4.')
|
|
subparser.add_argument('archive', metavar='ARCHIVE',
|
|
subparser.add_argument('archive', metavar='ARCHIVE',
|
|
type=location_validator(archive=True),
|
|
type=location_validator(archive=True),
|
|
help='archive to create')
|
|
help='archive to create')
|