Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
rocon_gateway.gateway_hub.GatewayHub Class Reference

List of all members.

Public Member Functions

def __init__
def advertise
 Posting Information to the Hub.
def get_flip_request_status
def get_local_advertisements
def get_multiple_flip_request_status
def get_remote_connection_state
def get_remote_gateway_firewall_flag
def get_unblocked_flipped_in_connections
def list_remote_gateway_names
def mark_named_gateway_available
def matches_remote_gateway_basename
def matches_remote_gateway_name
def post_flip_details
def post_pull_details
def publish_network_statistics
def register_gateway
 Hub Connections.
def remote_gateway_info
 Hub Data Retrieval.
def remove_flip_details
def remove_pull_details
def send_flip_request
def send_unflip_request
def unadvertise
def unregister_gateway
def unregister_named_gateway
def update_flip_request_status
def update_multiple_flip_request_status
def update_named_gateway_latency_stats

Public Attributes

 connection_lost_lock
 hub_connection_checker_thread

Private Member Functions

def _hub_connection_lost_hook
def _parse_redis_bool
def _parse_redis_float
def _parse_redis_int
def _resend_all_flip_ins
 Flip specific communication.
def _send_unflip_request

Private Attributes

 _firewall
 _hub_connection_lost_gateway_hook
 _unique_gateway_name

Detailed Description

Definition at line 69 of file gateway_hub.py.


Constructor & Destructor Documentation

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.


Member Function Documentation

  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.

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.

  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.

  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.

  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.

  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.

  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.

  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.

  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.

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.

  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.


Member Data Documentation

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.


The documentation for this class was generated from the following file:


rocon_gateway
Author(s): Daniel Stonier , Jihoon Lee , Piyush Khandelwal
autogenerated on Sat Jun 8 2019 18:48:44