Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 import re
00011
00012
00013
00014
00015
00016
00017 def create_rocon_key(key):
00018 '''
00019 Root the specified redis key name in our pseudo redis database.
00020 '''
00021 if re.match('rocon:', key):
00022 return key
00023 else:
00024 return 'rocon:' + key
00025
00026
00027 def create_rocon_hub_key(key):
00028 '''
00029 Root the specified redis key name in our pseudo redis database under
00030 the hub namespace
00031 '''
00032 if re.match('rocon:hub:', key):
00033 return key
00034 else:
00035 return 'rocon:hub:' + key
00036
00037
00038 def create_rocon_gateway_key(unique_gateway_name, key):
00039 '''
00040 Root the specified redis key name in our pseudo redis database under
00041 the gateway namespace.
00042
00043 @note : currently does no checking of the incoming keys
00044 '''
00045 return 'rocon:' + unique_gateway_name + ":" + key
00046
00047
00048 def extract_rocon_key(key):
00049 '''
00050 Extract the specified redis key name from our pseudo redis database.
00051 '''
00052 if re.match('rocon:', key):
00053 return re.sub(r'rocon:', '', key)
00054 else:
00055 return key
00056
00057
00058 def key_base_name(key):
00059 '''
00060 Extract the base name (i.e. last value) from the key.
00061 e.g. rocon:key:pirate24 -> pirate24
00062 '''
00063 return key.split(':')[-1]