Class Polo¶
-
class
marcopolo.polo.polo.
Polo
(offered_services=None, user_services=None, multicast_group=None, verify_regexp=None)[source]¶ Twisted-inherited class in charge of receiving Marco requests on the defined multicast groups
-
__init__
(offered_services=None, user_services=None, multicast_group=None, verify_regexp=None)[source]¶ Creates the
Polo
instance with the data structures to work with. If defined, theoffered_services
anduser_services
variables will be treated as references to a list and dictionary respectively (i.e. the values will be modified, but the object reference will never be altered).Parameters: - offered_services (list) – A list of dictionaries which comprises all the root services.
- user_services (dict) – A dictionary of all the user services (the key is the user name and the value is a list of services like that of offered_services).
- multicast_group (str) – The IPv4 address of the multicast group to join to. Important: The multicast_addr is not validated until the reactor is started.
- verify_regexp (str) – Regular expression used to verify an user service.
-
datagramReceived
(datagram, address)[source]¶ When a datagram is received the command is parsed and a response is generated
Parameters:
-
handler
(arg)[source]¶ An ‘errback’ that is called when the multicast subscription is unsuccessful. It schedules a retry and increments an attempt counter.
Parameters: arg (object) – The arg passed in the addErrback() call
-
reload_services
()[source]¶ Reloads both root and user services (calling
reload_user_services()
). The services stored in a file are loaded again, whereas dynamic services are kept intact.
-
reload_user_services
()[source]¶ Iterates through all the users who have services and calls reload_user_services_iter for each of them
-
reload_user_services_iter
(user)[source]¶ Reloads the services for a given user
Parameters: user (str) – The name of the user
-