Skip to content
Snippets Groups Projects
Unverified Commit 9f76baed authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Turns out we will probably be able to pass in all share sizes

parent 06b6f2c3
No related branches found
No related tags found
1 merge request!80Record pass spending during lease maintenance
...@@ -533,16 +533,11 @@ class LeaseMaintenance(object): ...@@ -533,16 +533,11 @@ class LeaseMaintenance(object):
self._rowid = cursor.lastrowid self._rowid = cursor.lastrowid
@with_cursor @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 count = required_passes(BYTES_PER_PASS, sizes)
# 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})
cursor.execute( cursor.execute(
""" """
UPDATE [lease-maintenance-spending] UPDATE [lease-maintenance-spending]
......
...@@ -297,7 +297,9 @@ class LeaseMaintenanceTests(TestCase): ...@@ -297,7 +297,9 @@ class LeaseMaintenanceTests(TestCase):
passes_required = 0 passes_required = 0
for (num_passes, trim_size) in sizes: for (num_passes, trim_size) in sizes:
passes_required += num_passes 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 now += finish_delay
x.finish() x.finish()
finished = now finished = now
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment