def perspective_register(self, name, port, load, role): self.name = name peer = Peers.selectBy(name = name) if peer.count() != 0: raise PeerRegistrationError("Peer Existed") info = self.mind.broker.transport.getPeer() if not info: raise PeerRegistrationError("Bad peer information") self.peerDB = Peers(name=name, ipAddress=info.host, port=port, load=load, role=role, uniqId=self.uniqId) return True
def logout(self): if self.peerDB: Peers.delete(self.peerDB.id) self.peerDB = None self.realm.logout(self)
def perspective_getWorldList(self): worldList = {} rows = Peers.selectBy(role = PeerType.World) for row in rows: worldList[row.uniqId] = row.name return worldList