1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-03-10 22:24:13 +00:00

compact: remove "borg compact", not needed any more

All chunks are separate objects in borgstore.
This commit is contained in:
Thomas Waldmann 2024-08-12 23:58:30 +02:00
parent c292ee25c5
commit 8c2cbdbb55
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
2 changed files with 0 additions and 70 deletions

View file

@ -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)

View file

@ -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)",
)