Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
ZKAPAuthorizer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Administrator
ZKAPAuthorizer
Commits
9f76baed
Unverified
Commit
9f76baed
authored
5 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
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
!80
Record pass spending during lease maintenance
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/_zkapauthorizer/model.py
+3
-8
3 additions, 8 deletions
src/_zkapauthorizer/model.py
src/_zkapauthorizer/tests/test_model.py
+3
-1
3 additions, 1 deletion
src/_zkapauthorizer/tests/test_model.py
with
6 additions
and
9 deletions
src/_zkapauthorizer/model.py
+
3
−
8
View file @
9f76baed
...
@@ -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
,
size
s
):
"""
"""
Record a storage
object
of
a
given size.
Record a storage
shares
of
the
given size
s
.
"""
"""
# 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]
...
...
This diff is collapsed.
Click to expand it.
src/_zkapauthorizer/tests/test_model.py
+
3
−
1
View file @
9f76baed
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment