in datahub/implement.py [0:0]
def split_shard(self, project_name, topic_name, shard_id, split_key=''):
if check_empty(project_name):
raise InvalidParameterException(ErrorMessage.PARAMETER_EMPTY % 'project_name')
if check_empty(topic_name):
raise InvalidParameterException(ErrorMessage.PARAMETER_EMPTY % 'topic_name')
if check_empty(shard_id):
raise InvalidParameterException(ErrorMessage.PARAMETER_EMPTY % 'shard_id')
if check_empty(split_key):
shard_info = self.__get_shard(project_name, topic_name, shard_id)
if not check_empty(shard_info):
begin_hash_key = int(shard_info.begin_hash_key, 16)
end_hash_key = int(shard_info.end_hash_key, 16)
split_key = hex(int((begin_hash_key + end_hash_key) // 2))[2:34]
url = Path.SHARDS % (project_name, topic_name)
request_param = SplitShardRequestParams(shard_id, split_key)
content = self._rest_client.post(url, data=request_param.content())
result = SplitShardResult.parse_content(content)
return result