mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-01 12:09:10 +00:00
ChunkIndex.add: remove useless refs parameter
This commit is contained in:
parent
94effcd782
commit
ba3e701730
3 changed files with 6 additions and 7 deletions
|
@ -808,7 +808,7 @@ def add_chunk(
|
|||
)
|
||||
self.repository.put(id, cdata, wait=wait)
|
||||
self.last_refresh_dt = now # .put also refreshed the lock
|
||||
self.chunks.add(id, 1, size)
|
||||
self.chunks.add(id, size)
|
||||
stats.update(size, not exists)
|
||||
return ChunkListEntry(id, size)
|
||||
|
||||
|
|
|
@ -56,8 +56,7 @@ class ChunkIndex(HTProxyMixin, MutableMapping):
|
|||
def iteritems(self):
|
||||
yield from self.ht.items()
|
||||
|
||||
def add(self, key, refs, size):
|
||||
assert refs > 0
|
||||
def add(self, key, size):
|
||||
v = self.get(key)
|
||||
if v is None:
|
||||
flags = self.F_USED
|
||||
|
|
|
@ -19,14 +19,14 @@ def H2(x):
|
|||
def test_chunkindex_add():
|
||||
chunks = ChunkIndex()
|
||||
x = H2(1)
|
||||
chunks.add(x, 1, 0)
|
||||
chunks.add(x, 0)
|
||||
assert chunks[x] == ChunkIndexEntry(flags=ChunkIndex.F_USED, size=0)
|
||||
chunks.add(x, 1, 2) # updating size (we do not have a size yet)
|
||||
chunks.add(x, 2) # updating size (we do not have a size yet)
|
||||
assert chunks[x] == ChunkIndexEntry(flags=ChunkIndex.F_USED, size=2)
|
||||
chunks.add(x, 1, 2)
|
||||
chunks.add(x, 2)
|
||||
assert chunks[x] == ChunkIndexEntry(flags=ChunkIndex.F_USED, size=2)
|
||||
with pytest.raises(AssertionError):
|
||||
chunks.add(x, 1, 3) # inconsistent size (we already have a different size)
|
||||
chunks.add(x, 3) # inconsistent size (we already have a different size)
|
||||
|
||||
|
||||
def test_keyerror():
|
||||
|
|
Loading…
Reference in a new issue