Browse Source

create --no-cache-sync-forced option

when given, force using the AdHocCache.
Thomas Waldmann 1 year ago
parent
commit
98162fbb42
2 changed files with 11 additions and 0 deletions
  1. 7 0
      src/borg/archiver/create_cmd.py
  2. 4 0
      src/borg/cache.py

+ 7 - 0
src/borg/archiver/create_cmd.py

@@ -225,6 +225,7 @@ class CreateMixIn:
                 progress=args.progress,
                 lock_wait=self.lock_wait,
                 permit_adhoc_cache=args.no_cache_sync,
+                force_adhoc_cache=args.no_cache_sync_forced,
                 cache_mode=args.files_cache_mode,
                 iec=args.iec,
             ) as cache:
@@ -803,6 +804,12 @@ class CreateMixIn:
             action="store_true",
             help="experimental: do not synchronize the cache. Implies not using the files cache.",
         )
+        subparser.add_argument(
+            "--no-cache-sync-forced",
+            dest="no_cache_sync_forced",
+            action="store_true",
+            help="experimental: do not synchronize the cache (forced). Implies not using the files cache.",
+        )
         subparser.add_argument(
             "--stdin-name",
             metavar="NAME",

+ 4 - 0
src/borg/cache.py

@@ -413,6 +413,7 @@ class Cache:
         progress=False,
         lock_wait=None,
         permit_adhoc_cache=False,
+        force_adhoc_cache=False,
         cache_mode=FILES_CACHE_MODE_DISABLED,
         iec=False,
     ):
@@ -431,6 +432,9 @@ class Cache:
         def adhoc():
             return AdHocCache(manifest=manifest, lock_wait=lock_wait, iec=iec)
 
+        if force_adhoc_cache:
+            return adhoc()
+
         if not permit_adhoc_cache:
             return local()