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
32fe40fa
Commit
32fe40fa
authored
3 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
MemoryGrid docstring and name improvement
parent
8f0bf0d9
Branches
restricted-sqlite-strategies
No related tags found
1 merge request
!295
Implement a limited form of the "recovery" endpoint of the replication/recovery design
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/_zkapauthorizer/tests/test_recover.py
+14
-3
14 additions, 3 deletions
src/_zkapauthorizer/tests/test_recover.py
with
14 additions
and
3 deletions
src/_zkapauthorizer/tests/test_recover.py
+
14
−
3
View file @
32fe40fa
...
...
@@ -242,17 +242,28 @@ class RecovererTestsMixin:
@define
class
MemoryGrid
:
"""
An extremely simplified in-memory model of a Tahoe-LAFS storage grid.
This object allows data to be
"
uploaded
"
to it and produces capability
strings which can then be used to
"
download
"
the data from it later on.
:ivar _counter: An internal counter used to support the creation of
capability strings.
:ivar _objects: Storage for all data which has been
"
uploaded
"
, as a
mapping from the capability strings to the values.
"""
_counter
:
int
=
0
_
snapsho
ts
:
Dict
[
str
,
str
]
=
field
(
default
=
Factory
(
dict
))
_
objec
ts
:
Dict
[
str
,
str
]
=
field
(
default
=
Factory
(
dict
))
def
upload
(
self
,
data
:
bytes
)
->
str
:
cap
=
str
(
self
.
_counter
)
self
.
_
snapsho
ts
[
cap
]
=
data
self
.
_
objec
ts
[
cap
]
=
data
self
.
_counter
+=
1
return
cap
def
download
(
self
,
cap
:
str
)
->
bytes
:
return
self
.
_
snapsho
ts
[
cap
]
return
self
.
_
objec
ts
[
cap
]
class
SynchronousStorageSnapshotRecovererTests
(
TestCase
,
RecovererTestsMixin
):
...
...
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