apply zooko's advice: storage_client get_known_servers() returns a frozenset, caller...
authorBrian Warner <warner@lothar.com>
Mon, 1 Aug 2011 17:44:52 +0000 (10:44 -0700)
committerBrian Warner <warner@lothar.com>
Mon, 1 Aug 2011 17:44:52 +0000 (10:44 -0700)
refs #1363

src/allmydata/storage_client.py
src/allmydata/web/root.py

index 187828d1dd364f3299456b2c64c3b553d5024107..aa696edb92bcd1c0cf2323037d9fafb537f8526e 100644 (file)
@@ -124,16 +124,13 @@ class StorageFarmBroker:
         return sorted(self.get_connected_servers(), key=_permuted)
 
     def get_all_serverids(self):
-        serverids = set()
-        serverids.update(self.servers.keys())
-        return frozenset(serverids)
+        return frozenset(self.servers.keys())
 
     def get_connected_servers(self):
-        return frozenset([s for s in self.get_known_servers()
-                          if s.get_rref()])
+        return frozenset([s for s in self.servers.values() if s.get_rref()])
 
     def get_known_servers(self):
-        return sorted(self.servers.values(), key=lambda s: s.get_serverid())
+        return frozenset(self.servers.values())
 
     def get_nickname_for_serverid(self, serverid):
         if serverid in self.servers:
index 1bef583284d54c2bf35e7cd3e6d1b07c9581b247..d7a832f52fe7a2228b33f5e37df5e160620c2dbc 100644 (file)
@@ -256,7 +256,7 @@ class Root(rend.Page):
 
     def data_services(self, ctx, data):
         sb = self.client.get_storage_broker()
-        return sb.get_known_servers()
+        return sorted(sb.get_known_servers(), key=lambda s: s.get_serverid())
 
     def render_service_row(self, ctx, server):
         nodeid = server.get_serverid()