mirror of https://github.com/borgbackup/borg.git
chunk_incref: use "size" for public api
This commit is contained in:
parent
663d3c544a
commit
fc3498ac53
|
@ -936,7 +936,7 @@ Utilization of max. archive size: {csize_max:.0%}
|
||||||
# if we created part files, we have referenced all chunks from the part files,
|
# if we created part files, we have referenced all chunks from the part files,
|
||||||
# but we also will reference the same chunks also from the final, complete file:
|
# but we also will reference the same chunks also from the final, complete file:
|
||||||
for chunk in item.chunks:
|
for chunk in item.chunks:
|
||||||
cache.chunk_incref(chunk.id, stats, size_=chunk.size)
|
cache.chunk_incref(chunk.id, stats, size=chunk.size)
|
||||||
|
|
||||||
def process_stdin(self, path, cache):
|
def process_stdin(self, path, cache):
|
||||||
uid, gid = 0, 0
|
uid, gid = 0, 0
|
||||||
|
|
|
@ -877,12 +877,12 @@ class LocalCache(CacheStatsMixin):
|
||||||
id, stored_size, size))
|
id, stored_size, size))
|
||||||
return refcount
|
return refcount
|
||||||
|
|
||||||
def chunk_incref(self, id, stats, size_=None):
|
def chunk_incref(self, id, stats, size=None):
|
||||||
if not self.txn_active:
|
if not self.txn_active:
|
||||||
self.begin_txn()
|
self.begin_txn()
|
||||||
count, size, csize = self.chunks.incref(id)
|
count, _size, csize = self.chunks.incref(id)
|
||||||
stats.update(size, csize, False)
|
stats.update(_size, csize, False)
|
||||||
return ChunkListEntry(id, size, csize)
|
return ChunkListEntry(id, _size, csize)
|
||||||
|
|
||||||
def chunk_decref(self, id, stats, wait=True):
|
def chunk_decref(self, id, stats, wait=True):
|
||||||
if not self.txn_active:
|
if not self.txn_active:
|
||||||
|
@ -979,7 +979,7 @@ Chunk index: {0.total_unique_chunks:20d} unknown"""
|
||||||
size = len(chunk)
|
size = len(chunk)
|
||||||
refcount = self.seen_chunk(id, size)
|
refcount = self.seen_chunk(id, size)
|
||||||
if refcount:
|
if refcount:
|
||||||
return self.chunk_incref(id, stats, size_=size)
|
return self.chunk_incref(id, stats, size=size)
|
||||||
data = self.key.encrypt(chunk)
|
data = self.key.encrypt(chunk)
|
||||||
csize = len(data)
|
csize = len(data)
|
||||||
self.repository.put(id, data, wait=wait)
|
self.repository.put(id, data, wait=wait)
|
||||||
|
@ -998,15 +998,15 @@ Chunk index: {0.total_unique_chunks:20d} unknown"""
|
||||||
self.chunks[id] = entry._replace(size=size)
|
self.chunks[id] = entry._replace(size=size)
|
||||||
return entry.refcount
|
return entry.refcount
|
||||||
|
|
||||||
def chunk_incref(self, id, stats, size_=None):
|
def chunk_incref(self, id, stats, size=None):
|
||||||
if not self._txn_active:
|
if not self._txn_active:
|
||||||
self._begin_txn()
|
self._begin_txn()
|
||||||
count, size, csize = self.chunks.incref(id)
|
count, _size, csize = self.chunks.incref(id)
|
||||||
# When size is 0 and size_ is not given, then this chunk has not been locally visited yet (seen_chunk with
|
# When _size is 0 and size is not given, then this chunk has not been locally visited yet (seen_chunk with
|
||||||
# size or add_chunk); we can't add references to those (size=0 is invalid) and generally don't try to.
|
# size or add_chunk); we can't add references to those (size=0 is invalid) and generally don't try to.
|
||||||
assert size or size_
|
assert _size or size
|
||||||
stats.update(size or size_, csize, False)
|
stats.update(_size or size, csize, False)
|
||||||
return ChunkListEntry(id, size or size_, csize)
|
return ChunkListEntry(id, _size or size, csize)
|
||||||
|
|
||||||
def chunk_decref(self, id, stats, wait=True):
|
def chunk_decref(self, id, stats, wait=True):
|
||||||
if not self._txn_active:
|
if not self._txn_active:
|
||||||
|
|
Loading…
Reference in New Issue