Definition at line 69 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.__init__ | ( | self, | |
ip, | |||
port, | |||
whitelist, | |||
blacklist | |||
) |
@param remote_gateway_request_callbacks : to handle redis responses @type list of function pointers (back to GatewaySync class @param ip : redis server ip @param port : redis server port @raise HubNameNotFoundError, HubNotFoundError
Definition at line 71 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub._hub_connection_lost_hook | ( | self | ) | [private] |
This gets triggered by the redis connection checker thread when the hub connection is lost. The trigger is passed to the gateway who needs to remove the hub.
Definition at line 149 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub._parse_redis_bool | ( | self, | |
val | |||
) | [private] |
Definition at line 485 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub._parse_redis_float | ( | self, | |
val | |||
) | [private] |
Definition at line 473 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub._parse_redis_int | ( | self, | |
val | |||
) | [private] |
Definition at line 479 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub._resend_all_flip_ins | ( | self | ) | [private] |
Flip specific communication.
Marks all flip ins to be resent. Until these flips are resent, they will not be processed
Definition at line 600 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub._send_unflip_request | ( | self, | |
remote_gateway, | |||
rule | |||
) | [private] |
Unflip a previously flipped registration. If the flip request does not exist (for instance, in the case where this hub was not used to send the request), then False is returned @return True if the flip existed and was removed, False otherwise @rtype Boolean
Definition at line 848 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.advertise | ( | self, | |
connection | |||
) |
Posting Information to the Hub.
Places a topic, service or action on the public interface. On the redis server, this representation will always be: - topic : a triple { name, type, xmlrpc node uri } - service : a triple { name, rosrpc uri, xmlrpc node uri } - action : ??? @param connection: representation of a connection (topic, service, action) @type connection: str @raise .exceptions.ConnectionTypeError: if connection arg is invalid.
Definition at line 495 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.get_flip_request_status | ( | self, | |
remote_rule | |||
) |
Get the status of a flipped registration. If the flip request does not exist (for instance, in the case where this hub was not used to send the request), then None is returned @return the flip status or None @rtype same as gateway_msgs.msg.RemoteRuleWithStatus.status or None
Definition at line 710 of file gateway_hub.py.
Retrieves the local list of advertisements from the hub. This gets used to sync across multiple hubs. @return dictionary of remote advertisements @rtype dictionary of connection type keyed connection values
Definition at line 457 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.get_multiple_flip_request_status | ( | self, | |
remote_rules | |||
) |
Get the status of multiple flipped registration. If the flip request does not exist (for instance, in the case where this hub was not used to send the request), then None is returned. Multiple requests are batched together for efficiency. @return the flip status, ordered as per the input remote rules @rtype list of gateway_msgs.msg.RemoteRuleWithStatus.status or None
Definition at line 722 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.get_remote_connection_state | ( | self, | |
remote_gateway | |||
) |
Equivalent to get_connection_state, but generates it from the public interface of a remote gateway @param remote_gateway : hash name for a remote gateway @type str @return dictionary of remote advertisements @rtype dictionary of connection type keyed connection values
Definition at line 416 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.get_remote_gateway_firewall_flag | ( | self, | |
gateway | |||
) |
Returns the value of the remote gateway's firewall (flip) flag. @param gateway : gateway string id @param string @return state of the flag @rtype Bool @raise GatewayUnavailableError when specified gateway is not on the hub
Definition at line 438 of file gateway_hub.py.
Gets all the flipped in connections listed on the hub that are interesting for this gateway (i.e. all unblocked/pending). This is used by the watcher loop to work out how it needs to update the local registrations. :returns: the flipped in registration strings and status. :rtype: list of (utils.Registration, FlipStatus.XXX) tuples.
Definition at line 622 of file gateway_hub.py.
Return a list of the gateways (name list, not redis keys). e.g. ['gateway32adcda32','pirate21fasdf']. If not connected, just returns an empty list.
Definition at line 363 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.mark_named_gateway_available | ( | self, | |
gateway_key, | |||
available = True , |
|||
time_since_last_seen = 0.0 |
|||
) |
This function is used by the hub to mark if a gateway can be pinged. If a gateway cannot be pinged, the hub indicates how longs has it been since the hub was last seen @param gateway_key : The gateway key (not the name) @type str @param available: If the gateway can be pinged right now @type bool @param time_since_last_seen: If available is false, how long has it been since the gateway was last seen (in seconds) @type float
Definition at line 255 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.matches_remote_gateway_basename | ( | self, | |
gateway | |||
) |
Use this when gateway can be a regular expression and we need to check it off against list_remote_gateway_names()
Definition at line 402 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.matches_remote_gateway_name | ( | self, | |
gateway | |||
) |
Use this when gateway can be a regular expression and we need to check it off against list_remote_gateway_names() @return a list of matches (higher level decides on action for duplicates). @rtype list[str] : list of remote gateway names.
Definition at line 385 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.post_flip_details | ( | self, | |
gateway, | |||
name, | |||
connection_type, | |||
node | |||
) |
Post flip details to the redis server. This has no actual functionality, it is just useful for debugging with the remote_gateway_info service. @param gateway : the target of the flip @type string @param name : the name of the connection @type string @param type : the type of the connection (one of ConnectionType.xxx @type string @param node : the node name it was pulled from @type string
Definition at line 524 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.post_pull_details | ( | self, | |
gateway, | |||
name, | |||
connection_type, | |||
node | |||
) |
Post pull details to the hub. This has no actual functionality, it is just useful for debugging with the remote_gateway_info service. @param gateway : the gateway it is pulling from @type string @param name : the name of the connection @type string @param type : the type of the connection (one of ConnectionType.xxx @type string @param node : the node name it was pulled from @type string
Definition at line 560 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.publish_network_statistics | ( | self, | |
statistics | |||
) |
Publish network interface information to the hub @param statistics @type gateway_msgs.RemoteGateway
Definition at line 180 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.register_gateway | ( | self, | |
firewall, | |||
unique_gateway_name, | |||
hub_connection_lost_gateway_hook, | |||
gateway_ip | |||
) |
Hub Connections.
Register a gateway with the hub. @param firewall @param unique_gateway_name @param hub_connection_lost_gateway_hook : used to trigger Gateway.disengage_hub(hub) on lost hub connections in redis pubsub listener thread. @gateway_ip @raise HubConnectionLostError if for some reason, the redis server has become unavailable.
Definition at line 98 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.remote_gateway_info | ( | self, | |
gateway | |||
) |
Hub Data Retrieval.
Return remote gateway information for the specified gateway string id. @param gateways : gateway id string to search for @type string @return remote gateway information @rtype gateway_msgs.RemotGateway or None
Definition at line 279 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.remove_flip_details | ( | self, | |
gateway, | |||
name, | |||
connection_type, | |||
node | |||
) |
Post flip details to the redis server. This has no actual functionality, it is just useful for debugging with the remote_gateway_info service. @param gateway : the target of the flip @type string @param name : the name of the connection @type string @param type : the type of the connection (one of ConnectionType.xxx @type string @param node : the node name it was pulled from @type string
Definition at line 542 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.remove_pull_details | ( | self, | |
gateway, | |||
name, | |||
connection_type, | |||
node | |||
) |
Post pull details to the hub. This has no actual functionality, it is just useful for debugging with the remote_gateway_info service. @param gateway : the gateway it was pulling from @type string @param name : the name of the connection @type string @param type : the type of the connection (one of ConnectionType.xxx @type string @param node : the node name it was pulled from @type string
Definition at line 578 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.send_flip_request | ( | self, | |
remote_gateway, | |||
connection, | |||
timeout = 15.0 |
|||
) |
Sends a message to the remote gateway via redis pubsub channel. This is called from the watcher thread, when a flip rule gets activated. - redis channel name: rocon:<remote_gateway_name> - data : list of [ command, gateway, rule type, type, xmlrpc_uri ] - [0] - command : in this case 'flip' - [1] - gateway : the name of this gateway, i.e. the flipper - [2] - name : local name - [3] - node : local node name - [4] - connection_type : one of ConnectionType.PUBLISHER etc - [5] - type_info : a ros format type (e.g. std_msgs/String or service api) - [6] - xmlrpc_uri : the xmlrpc node uri @param command : string command name - either 'flip' or 'unflip' @type str @param flip_rule : the flip to send @type gateway_msgs.RemoteRule @param type_info : topic type (e.g. std_msgs/String) @param str @param xmlrpc_uri : the node uri @param str
Definition at line 761 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.send_unflip_request | ( | self, | |
remote_gateway, | |||
rule | |||
) |
Definition at line 816 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.unadvertise | ( | self, | |
connection | |||
) |
Removes a topic, service or action from the public interface. @param connection: representation of a connection (topic, service, action) @type connection: str @raise .exceptions.ConnectionTypeError: if connectionarg is invalid.
Definition at line 512 of file gateway_hub.py.
Remove all gateway info from the hub. @return: success or failure of the operation @rtype: bool
Definition at line 162 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.unregister_named_gateway | ( | self, | |
gateway_key | |||
) |
Remove all gateway info for given gateway key from the hub.
Definition at line 221 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.update_flip_request_status | ( | self, | |
registration_with_status | |||
) |
Updates the flip request status for this hub @param registration_with_status : the flip registration for which we are updating status @type (utils.Registration, str) where str is the status @param status : pending/accepted/blocked @type same as gateway_msgs.msg.RemoteRuleWithStatus.status @return True if this hub was used to send the flip request, and the status was updated. False otherwise. @rtype Boolean
Definition at line 649 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.update_multiple_flip_request_status | ( | self, | |
registrations_with_status | |||
) |
Updates the flip request status for multiple registrations on this hub @param registrations_with_status : the flip registration for which we are updating status @type list of (utils.Registration, str) where str is the status @param status : pending/accepted/blocked @type same as gateway_msgs.msg.RemoteRuleWithStatus.status @return True if this hub was used to send the flip request, false otherwise. @rtype Boolean
Definition at line 665 of file gateway_hub.py.
def rocon_gateway.gateway_hub.GatewayHub.update_named_gateway_latency_stats | ( | self, | |
gateway_name, | |||
latency_stats | |||
) |
For a given gateway, update the latency statistics #param gateway_name : gateway name, not the redis key @type str @param latency_stats : ping statistics to the gateway from the hub @type list : 4-tuple of float values [min, avg, max, mean deviation]
Definition at line 234 of file gateway_hub.py.
Definition at line 79 of file gateway_hub.py.
Definition at line 79 of file gateway_hub.py.
Definition at line 79 of file gateway_hub.py.
Definition at line 108 of file gateway_hub.py.
Definition at line 108 of file gateway_hub.py.