2 # Thierry Parmentelat - INRIA
7 from PLC.Faults import *
8 from PLC.Method import Method
9 from PLC.Parameter import Parameter, Mixed
10 from PLC.Auth import Auth
12 from PLC.Peers import Peer, Peers
14 from PLC.Sites import Site, Sites
15 from PLC.Keys import Key, Keys
16 from PLC.Nodes import Node, Nodes
17 from PLC.Persons import Person, Persons
18 from PLC.SliceAttributeTypes import SliceAttributeType, SliceAttributeTypes
19 from PLC.Slices import Slice, Slices
20 from PLC.SliceAttributes import SliceAttribute, SliceAttributes
22 class GetPeerData (Method):
24 Gather all data needed by RefreshPeer in a single xmlrpc request
26 Expects a peer id or peer name, that identifies the requesting peer
28 Returns a dict containing, for the various types of cached entities,
29 the local objects as well as the ones attached to that peer
35 Parameter (int, "Peer id"),
38 returns = Parameter (dict,"Sites, Keys, Nodes, Persons, Slices")
40 def call (self, auth, peer_id):
41 # xxx a peer cannot yet compute it's peer_id under another plc
42 # so we return all foreign objects by now
46 'Sites-local' : Sites (self.api,{'peer_id':None}),
47 'Sites-peer' : Sites (self.api,{'~peer_id':None}),
48 'Keys-local' : Keys (self.api,{'peer_id':None}),
49 'Keys-peer' : Keys (self.api,{'~peer_id':None}),
50 'Nodes-local' : Nodes (self.api,{'peer_id':None}),
51 'Nodes-peer' : Nodes (self.api,{'~peer_id':None}),
52 'Persons-local' : Persons (self.api,{'peer_id':None}),
53 'Persons-peer' : Persons (self.api,{'~peer_id':None}),
54 'SliceAttibuteTypes-local' : SliceAttributeTypes (self.api,{'peer_id':None}),
55 'SliceAttibuteTypes-peer' : SliceAttributeTypes (self.api,{'~peer_id':None}),
56 'Slices-local' : Slices (self.api,{'peer_id':None}),
57 'Slices-peer' : Slices (self.api,{'~peer_id':None}),
58 'SliceAttributes-local': SliceAttributes (self.api,{'peer_id':None}),
59 'SliceAttributes-peer': SliceAttributes (self.api,{'~peer_id':None}),
62 result['ellapsed'] = t_end-t_start