mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-21 10:01:54 +00:00
Better name.
This commit is contained in:
parent
4afe3eb224
commit
07e16b80b5
@ -658,10 +658,10 @@ class HTTPServer(object):
|
||||
"/v1/mutable/<storage_index:storage_index>/shares",
|
||||
methods=["GET"],
|
||||
)
|
||||
def list_mutable_shares(self, request, authorization, storage_index):
|
||||
def enumerate_mutable_shares(self, request, authorization, storage_index):
|
||||
"""List mutable shares for a storage index."""
|
||||
try:
|
||||
shares = self._storage_server.list_mutable_shares(storage_index)
|
||||
shares = self._storage_server.enumerate_mutable_shares(storage_index)
|
||||
except KeyError:
|
||||
raise _HTTPError(http.NOT_FOUND)
|
||||
return self._send_encoded(request, shares)
|
||||
|
@ -690,7 +690,7 @@ class StorageServer(service.MultiService):
|
||||
self)
|
||||
return share
|
||||
|
||||
def list_mutable_shares(self, storage_index) -> set[int]:
|
||||
def enumerate_mutable_shares(self, storage_index) -> set[int]:
|
||||
"""List all share numbers for the given mutable.
|
||||
|
||||
Raises ``KeyError`` if the storage index is not known.
|
||||
|
@ -1315,26 +1315,26 @@ class MutableServer(unittest.TestCase):
|
||||
self.failUnless(isinstance(readv_data, dict))
|
||||
self.failUnlessEqual(len(readv_data), 0)
|
||||
|
||||
def test_list_mutable_shares(self):
|
||||
def test_enumerate_mutable_shares(self):
|
||||
"""
|
||||
``StorageServer.list_mutable_shares()`` returns a set of share numbers
|
||||
``StorageServer.enumerate_mutable_shares()`` returns a set of share numbers
|
||||
for the given storage index, or raises ``KeyError`` if it does not exist at all.
|
||||
"""
|
||||
ss = self.create("test_list_mutable_shares")
|
||||
ss = self.create("test_enumerate_mutable_shares")
|
||||
|
||||
# Initially, nothing exists:
|
||||
with self.assertRaises(KeyError):
|
||||
ss.list_mutable_shares(b"si1")
|
||||
ss.enumerate_mutable_shares(b"si1")
|
||||
|
||||
self.allocate(ss, b"si1", b"we1", b"le1", [0, 1, 4, 2], 12)
|
||||
shares0_1_2_4 = ss.list_mutable_shares(b"si1")
|
||||
shares0_1_2_4 = ss.enumerate_mutable_shares(b"si1")
|
||||
|
||||
# Remove share 2, by setting size to 0:
|
||||
secrets = (self.write_enabler(b"we1"),
|
||||
self.renew_secret(b"le1"),
|
||||
self.cancel_secret(b"le1"))
|
||||
ss.slot_testv_and_readv_and_writev(b"si1", secrets, {2: ([], [], 0)}, [])
|
||||
shares0_1_4 = ss.list_mutable_shares(b"si1")
|
||||
shares0_1_4 = ss.enumerate_mutable_shares(b"si1")
|
||||
self.assertEqual(
|
||||
(shares0_1_2_4, shares0_1_4),
|
||||
({0, 1, 2, 4}, {0, 1, 4})
|
||||
|
Loading…
x
Reference in New Issue
Block a user