func()

in datahub/implement.go [1703:1734]


func (datahub *DataHubBatch) GetTupleRecords(projectName, topicName, shardId, cursor string, limit int, recordSchema *RecordSchema) (*GetRecordsResult, error) {
	if !util.CheckProjectName(projectName) {
		return nil, NewInvalidParameterErrorWithMessage(projectNameInvalid)
	}
	if !util.CheckTopicName(topicName) {
		return nil, NewInvalidParameterErrorWithMessage(topicNameInvalid)
	}
	if !util.CheckShardId(shardId) {
		return nil, NewInvalidParameterErrorWithMessage(shardIdInvalid)
	}

	path := fmt.Sprintf(shardPath, projectName, topicName, shardId)
	reqPara := &RequestParameter{
		Header: map[string]string{
			httpHeaderContentType:   httpProtoBatchContent,
			httpHeaderRequestAction: httpSubscribeContent},
	}
	gbr := &GetBatchRecordRequest{
		GetPBRecordRequest{
			Cursor: cursor,
			Limit:  limit,
		},
	}

	respBody, commonResp, err := datahub.Client.Post(path, gbr, reqPara)
	if err != nil {
		return nil, err
	}

	deserializer := newBatchDeserializer(projectName, topicName, shardId, recordSchema, datahub.schemaClient)
	return NewGetBatchRecordsResult(respBody, recordSchema, commonResp, deserializer)
}