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
91ed7e7b
Commit
91ed7e7b
authored
5 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
Switch to newly added get_leases method on the storage server
parent
6e4b280e
No related branches found
No related tags found
1 merge request
!22
Separate mutable writes from lease updates
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/_zkapauthorizer/tests/test_storage_protocol.py
+2
-24
2 additions, 24 deletions
src/_zkapauthorizer/tests/test_storage_protocol.py
with
2 additions
and
24 deletions
src/_zkapauthorizer/tests/test_storage_protocol.py
+
2
−
24
View file @
91ed7e7b
...
@@ -270,7 +270,7 @@ class ShareTests(TestCase):
...
@@ -270,7 +270,7 @@ class ShareTests(TestCase):
cancel_secret
,
cancel_secret
,
),
),
)
)
[(
_
,
leases
)]
=
get_leases
(
self
.
server
,
storage_index
)
.
items
(
)
leases
=
list
(
self
.
anonymous_storage_server
.
get_leases
(
storage_index
))
self
.
assertThat
(
leases
,
HasLength
(
2
))
self
.
assertThat
(
leases
,
HasLength
(
2
))
@given
(
@given
(
...
@@ -315,7 +315,7 @@ class ShareTests(TestCase):
...
@@ -315,7 +315,7 @@ class ShareTests(TestCase):
# Based on Tahoe-LAFS' hard-coded renew time.
# Based on Tahoe-LAFS' hard-coded renew time.
RENEW_INTERVAL
=
60
*
60
*
24
*
31
RENEW_INTERVAL
=
60
*
60
*
24
*
31
[(
_
,
[
lease
]
)]
=
get_leases
(
self
.
server
,
storage_index
)
.
items
()
[
lease
]
=
self
.
anonymous_storage_server
.
get_leases
(
storage_index
)
self
.
assertThat
(
self
.
assertThat
(
lease
.
get_expiration_time
(),
lease
.
get_expiration_time
(),
Equals
(
int
(
now
+
RENEW_INTERVAL
)),
Equals
(
int
(
now
+
RENEW_INTERVAL
)),
...
@@ -522,28 +522,6 @@ def write_toy_shares(
...
@@ -522,28 +522,6 @@ def write_toy_shares(
writer
.
remote_close
()
writer
.
remote_close
()
def
get_leases
(
storage_server
,
storage_index
):
"""
Get all leases for all shares of the given storage index on the given
server.
:param StorageServer storage_server: The storage server on which to find
the information.
:param bytes storage_index: The storage index for which to look up shares.
:return dict[int, list[LeaseInfo]]: The lease information for each share.
"""
# It's hard to assert much about the lease without knowing about *some*
# implementation details of the storage server. I prefer to know Python
# API details rather than on-disk format details.
return
{
sharenum
:
list
(
reader
.
_share_file
.
get_leases
())
for
(
sharenum
,
reader
)
in
storage_server
.
remote_get_buckets
(
storage_index
).
items
()
}
def
cleanup_storage_server
(
storage_server
):
def
cleanup_storage_server
(
storage_server
):
"""
"""
Delete all of the shares held by the given storage server.
Delete all of the shares held by the given storage server.
...
...
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