in datahub/implement.go [1672:1701]
func (datahub *DataHubBatch) PutRecordsByShard(projectName, topicName, shardId string, records []IRecord) (*PutRecordsByShardResult, 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: httpPublistContent},
}
serializer := newBatchSerializer(projectName, topicName, datahub.cType, datahub.schemaClient)
prr := &PutBatchRecordsRequest{
serializer: serializer,
Records: records,
}
_, commonResp, err := datahub.Client.Post(path, prr, reqPara)
if err != nil {
return nil, err
}
return NewPutRecordsByShardResult(commonResp)
}