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
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
23a94596
Unverified
Commit
23a94596
authored
4 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
Log some info about pass calculation for mutable shares
parent
ee6b7bc3
No related branches found
Branches containing commit
No related tags found
1 merge request
!166
More spending logging
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/_zkapauthorizer/eliot.py
+30
-0
30 additions, 0 deletions
src/_zkapauthorizer/eliot.py
src/_zkapauthorizer/storage_common.py
+18
-6
18 additions, 6 deletions
src/_zkapauthorizer/storage_common.py
with
48 additions
and
6 deletions
src/_zkapauthorizer/eliot.py
+
30
−
0
View file @
23a94596
...
...
@@ -80,3 +80,33 @@ CALL_WITH_PASSES = ActionType(
[],
u
"
A storage operation is being started which may spend some passes.
"
,
)
CURRENT_SIZES
=
Field
(
u
"
current_sizes
"
,
dict
,
u
"
A dictionary mapping the numbers of existing shares to their existing sizes.
"
,
)
TW_VECTORS_SUMMARY
=
Field
(
u
"
tw_vectors_summary
"
,
dict
,
u
"
A dictionary mapping share numbers from tw_vectors to test and write vector summaries.
"
,
)
NEW_SIZES
=
Field
(
u
"
new_sizes
"
,
dict
,
u
"
A dictionary like that of CURRENT_SIZES but for the sizes computed for the shares after applying tw_vectors.
"
,
)
NEW_PASSES
=
Field
(
u
"
new_passes
"
,
int
,
u
"
The number of passes computed as being required for the change in size.
"
,
)
MUTABLE_PASSES_REQUIRED
=
MessageType
(
u
"
zkapauthorizer:storage:mutable-passes-required
"
,
[
CURRENT_SIZES
,
TW_VECTORS_SUMMARY
,
NEW_SIZES
,
NEW_PASSES
],
u
"
Some number of passes has been computed as the cost of updating a mutable.
"
,
)
This diff is collapsed.
Click to expand it.
src/_zkapauthorizer/storage_common.py
+
18
−
6
View file @
23a94596
...
...
@@ -30,6 +30,10 @@ from .validators import (
greater_than
,
)
from
.eliot
import
(
MUTABLE_PASSES_REQUIRED
,
)
@attr.s
(
frozen
=
True
)
class
MorePassesRequired
(
Exception
):
"""
...
...
@@ -180,8 +184,9 @@ def get_implied_data_length(data_vector, new_length):
def
get_required_new_passes_for_mutable_write
(
pass_value
,
current_sizes
,
tw_vectors
):
"""
:param int pass_value: The value of a single pass in byte-months.
:param current_sizes:
"""
# print("get_required_new_passes_for_mutable_write({}, {})".format(current_sizes, summarize(tw_vectors)))
current_passes
=
required_passes
(
pass_value
,
current_sizes
.
values
(),
...
...
@@ -204,16 +209,23 @@ def get_required_new_passes_for_mutable_write(pass_value, current_sizes, tw_vect
)
required_new_passes
=
new_passes
-
current_passes
# print("Current sizes: {}".format(current_sizes))
# print("Current passes: {}".format(current_passes))
# print("New sizes: {}".format(new_sizes))
# print("New passes: {}".format(new_passes))
MUTABLE_PASSES_REQUIRED
.
log
(
current_sizes
=
current_sizes
,
tw_vectors_summary
=
summarize
(
tw_vectors
),
current_passes
=
current_passes
,
new_sizes
=
new_sizes
,
new_passes
=
new_passes
,
)
return
required_new_passes
def
summarize
(
tw_vectors
):
return
{
sharenum
:
(
test_vector
,
list
(
(
offset
,
length
,
operator
,
len
(
specimen
))
for
(
offset
,
length
,
operator
,
specimen
)
in
test_vector
),
list
(
(
offset
,
len
(
data
))
for
(
offset
,
data
)
...
...
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