From: Brian Warner Date: Mon, 1 Aug 2011 17:44:52 +0000 (-0700) Subject: apply zooko's advice: storage_client get_known_servers() returns a frozenset, caller... X-Git-Url: https://git.rkrishnan.org/simplejson/components/%22file:/?a=commitdiff_plain;h=feca907499070bc13cac0088dee26caeade504b0;p=tahoe-lafs%2Ftahoe-lafs.git apply zooko's advice: storage_client get_known_servers() returns a frozenset, caller sorts refs #1363 --- diff --git a/src/allmydata/storage_client.py b/src/allmydata/storage_client.py index 187828d1..aa696edb 100644 --- a/src/allmydata/storage_client.py +++ b/src/allmydata/storage_client.py @@ -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: diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index 1bef5832..d7a832f5 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -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()