func()

in datahub/implement.go [1014:1041]


func (datahub *DataHub) UpdateConnectorOffset(projectName, topicName, connectorId, shardId string, offset ConnectorOffset) (*UpdateConnectorOffsetResult, 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(connectorPath, projectName, topicName, connectorId)
	reqPara := &RequestParameter{
		Header: map[string]string{httpHeaderContentType: httpJsonContent},
	}
	ucor := &UpdateConnectorOffsetRequest{
		Action:    "updateshardcontext",
		ShardId:   shardId,
		Timestamp: offset.Timestamp,
		Sequence:  offset.Sequence,
	}

	_, commonResp, err := datahub.Client.Post(path, ucor, reqPara)
	if err != nil {
		return nil, err
	}
	return NewUpdateConnectorOffsetResult(commonResp)
}