| 99 | | def bools(self, (mgr,info), msg, clientid=None): |
|---|
| 100 | | self.clients.send_all(msg) |
|---|
| 101 | | res = [] |
|---|
| 102 | | for (c, i) in self.clients.get_clients().items(): |
|---|
| 103 | | ret = pickle.load(c.makefile()) |
|---|
| 104 | | n = storage.NodeStatus(i[0], storage_root) |
|---|
| 105 | | for bool in val.body.keys(): |
|---|
| 106 | | n.set_bool_status(bool, msg.body[bool]) |
|---|
| 107 | | n.update() |
|---|
| 108 | | res.append((ret, i)) |
|---|
| 109 | | return res |
|---|
| | 102 | ### Old style of doing this. handler sent messages and processed results. |
|---|
| | 103 | ### Now Bad! |
|---|
| | 104 | ### def bools(self, (mgr,info), msg, clientid=None): |
|---|
| | 105 | ### self.clients.send_all(msg) |
|---|
| | 106 | ### res = [] |
|---|
| | 107 | ### for (c, i) in self.clients.get_clients().items(): |
|---|
| | 108 | ### ret = pickle.load(c.makefile()) |
|---|
| | 109 | ### n = storage.NodeStatus(i[0], storage_root) |
|---|
| | 110 | ### for bool in val.body.keys(): |
|---|
| | 111 | ### n.set_bool_status(bool, msg.body[bool]) |
|---|
| | 112 | ### n.update() |
|---|
| | 113 | ### res.append((ret, i)) |
|---|
| | 114 | ### return res |
|---|
| | 115 | # Now does the work of handling a single result from the result of comm() |
|---|
| | 116 | # for the server side part. |
|---|
| | 117 | def bools(self, (val, clientid)): |
|---|
| | 118 | n = storage.NodeStatus(clientid, storage_root) |
|---|
| | 119 | for (key,val) in val.items(): |
|---|
| | 120 | n.set_bool_status(key, val) |
|---|
| | 121 | n.update() |
|---|
| | 122 | |
|---|