From 32fe40fa46c8d8c747dd6efc4c789c969deabd28 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Sat, 12 Feb 2022 19:52:48 -0500 Subject: [PATCH] MemoryGrid docstring and name improvement --- src/_zkapauthorizer/tests/test_recover.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/_zkapauthorizer/tests/test_recover.py b/src/_zkapauthorizer/tests/test_recover.py index 2b50e65..68e6930 100644 --- a/src/_zkapauthorizer/tests/test_recover.py +++ b/src/_zkapauthorizer/tests/test_recover.py @@ -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 - _snapshots: Dict[str, str] = field(default=Factory(dict)) + _objects: Dict[str, str] = field(default=Factory(dict)) def upload(self, data: bytes) -> str: cap = str(self._counter) - self._snapshots[cap] = data + self._objects[cap] = data self._counter += 1 return cap def download(self, cap: str) -> bytes: - return self._snapshots[cap] + return self._objects[cap] class SynchronousStorageSnapshotRecovererTests(TestCase, RecovererTestsMixin): -- GitLab