diff --git a/src/_zkapauthorizer/model.py b/src/_zkapauthorizer/model.py index 8a3b8ec91de583a8cf9195034ef7c75f1a71b5f3..2dff026a4c112391c368bcb0fc4edd7442aa9d92 100644 --- a/src/_zkapauthorizer/model.py +++ b/src/_zkapauthorizer/model.py @@ -533,16 +533,11 @@ class LeaseMaintenance(object): self._rowid = cursor.lastrowid @with_cursor - def observe(self, cursor, size): + def observe(self, cursor, sizes): """ - Record a storage object of a given size. + Record a storage shares of the given sizes. """ - # XXX The client has no idea how many shares a server is storing and - # can do nothing except renew the lease on all of them. :( Here, guess - # that there is only one share. "Servers of happiness" should make - # this more likely to be the case... We might be underestimating - # storage costs though. - count = required_passes(BYTES_PER_PASS, {size}) + count = required_passes(BYTES_PER_PASS, sizes) cursor.execute( """ UPDATE [lease-maintenance-spending] diff --git a/src/_zkapauthorizer/tests/test_model.py b/src/_zkapauthorizer/tests/test_model.py index 018eb07f20fc7e526b7d8b30305566c93ec0e29c..be418c071bf69edb96c0dcc712ddfddc65e854de 100644 --- a/src/_zkapauthorizer/tests/test_model.py +++ b/src/_zkapauthorizer/tests/test_model.py @@ -297,7 +297,9 @@ class LeaseMaintenanceTests(TestCase): passes_required = 0 for (num_passes, trim_size) in sizes: passes_required += num_passes - x.observe(num_passes * BYTES_PER_PASS - trim_size) + x.observe({ + num_passes * BYTES_PER_PASS - trim_size + }) now += finish_delay x.finish() finished = now