Pārlūkot izejas kodu

fix AdHocCache.add_chunk signature (ctype, clevel kwargs)

Thomas Waldmann 1 gadu atpakaļ
vecāks
revīzija
de342581d6
1 mainītis faili ar 17 papildinājumiem un 2 dzēšanām
  1. 17 2
      src/borg/cache.py

+ 17 - 2
src/borg/cache.py

@@ -1160,7 +1160,20 @@ Chunk index:    {0.total_unique_chunks:20d}             unknown"""
     def memorize_file(self, hashed_path, path_hash, st, chunks):
         pass
 
-    def add_chunk(self, id, meta, data, *, stats, wait=True, compress=True, size=None, ro_type=ROBJ_FILE_STREAM):
+    def add_chunk(
+        self,
+        id,
+        meta,
+        data,
+        *,
+        stats,
+        wait=True,
+        compress=True,
+        size=None,
+        ctype=None,
+        clevel=None,
+        ro_type=ROBJ_FILE_STREAM,
+    ):
         assert ro_type is not None
         if not self._txn_active:
             self.begin_txn()
@@ -1172,7 +1185,9 @@ Chunk index:    {0.total_unique_chunks:20d}             unknown"""
         refcount = self.seen_chunk(id, size)
         if refcount:
             return self.chunk_incref(id, size, stats)
-        cdata = self.repo_objs.format(id, meta, data, compress=compress, ro_type=ro_type)
+        cdata = self.repo_objs.format(
+            id, meta, data, compress=compress, size=size, ctype=ctype, clevel=clevel, ro_type=ro_type
+        )
         self.repository.put(id, cdata, wait=wait)
         self.chunks.add(id, 1, size)
         stats.update(size, not refcount)