diff --git a/src/borg/archiver/__init__.py b/src/borg/archiver/__init__.py index 1e1e11eed..7b92419f3 100644 --- a/src/borg/archiver/__init__.py +++ b/src/borg/archiver/__init__.py @@ -67,7 +67,6 @@ def get_func(args): from .benchmark_cmd import BenchmarkMixIn from .check_cmd import CheckMixIn -from .compact_cmd import CompactMixIn from .create_cmd import CreateMixIn from .debug_cmd import DebugMixIn from .delete_cmd import DeleteMixIn @@ -96,7 +95,6 @@ from .version_cmd import VersionMixIn class Archiver( BenchmarkMixIn, CheckMixIn, - CompactMixIn, CreateMixIn, DebugMixIn, DeleteMixIn, @@ -333,7 +331,6 @@ class Archiver( self.build_parser_benchmarks(subparsers, common_parser, mid_common_parser) self.build_parser_check(subparsers, common_parser, mid_common_parser) - self.build_parser_compact(subparsers, common_parser, mid_common_parser) self.build_parser_create(subparsers, common_parser, mid_common_parser) self.build_parser_debug(subparsers, common_parser, mid_common_parser) self.build_parser_delete(subparsers, common_parser, mid_common_parser) diff --git a/src/borg/archiver/compact_cmd.py b/src/borg/archiver/compact_cmd.py deleted file mode 100644 index ea3093ec5..000000000 --- a/src/borg/archiver/compact_cmd.py +++ /dev/null @@ -1,67 +0,0 @@ -import argparse - -from ._common import with_repository, Highlander -from ..constants import * # NOQA -from ..manifest import Manifest -from ..repository3 import Repository3 -from ..remote3 import RemoteRepository3 - -from ..logger import create_logger - -logger = create_logger() - - -class CompactMixIn: - @with_repository(manifest=False, exclusive=True) - def do_compact(self, args, repository): - """compact segment files in the repository""" - if not isinstance(repository, (Repository3, RemoteRepository3)): - # see the comment in do_with_lock about why we do it like this: - data = repository.get(Manifest.MANIFEST_ID) - repository.put(Manifest.MANIFEST_ID, data) - threshold = args.threshold / 100 - repository.commit(compact=True, threshold=threshold) - - def build_parser_compact(self, subparsers, common_parser, mid_common_parser): - from ._common import process_epilog - - compact_epilog = process_epilog( - """ - This command frees repository space by compacting segments. - - Use this regularly to avoid running out of space - you do not need to use this - after each borg command though. It is especially useful after deleting archives, - because only compaction will really free repository space. - - borg compact does not need a key, so it is possible to invoke it from the - client or also from the server. - - Depending on the amount of segments that need compaction, it may take a while, - so consider using the ``--progress`` option. - - A segment is compacted if the amount of saved space is above the percentage value - given by the ``--threshold`` option. If omitted, a threshold of 10% is used. - When using ``--verbose``, borg will output an estimate of the freed space. - - See :ref:`separate_compaction` in Additional Notes for more details. - """ - ) - subparser = subparsers.add_parser( - "compact", - parents=[common_parser], - add_help=False, - description=self.do_compact.__doc__, - epilog=compact_epilog, - formatter_class=argparse.RawDescriptionHelpFormatter, - help="compact segment files / free space in repo", - ) - subparser.set_defaults(func=self.do_compact) - subparser.add_argument( - "--threshold", - metavar="PERCENT", - dest="threshold", - type=int, - default=10, - action=Highlander, - help="set minimum threshold for saved space in PERCENT (Default: 10)", - )