當前位置: 首頁>>代碼示例>>Golang>>正文


Golang TopicResponse.Err方法代碼示例

本文整理匯總了Golang中github.com/couchbase/indexing/secondary/protobuf/projector.TopicResponse.Err方法的典型用法代碼示例。如果您正苦於以下問題:Golang TopicResponse.Err方法的具體用法?Golang TopicResponse.Err怎麽用?Golang TopicResponse.Err使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/couchbase/indexing/secondary/protobuf/projector.TopicResponse的用法示例。


在下文中一共展示了TopicResponse.Err方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: MutationTopicRequest

func (c *monitorTestProjectorClient) MutationTopicRequest(topic, endpointType string,
	reqTimestamps []*protobuf.TsVbuuid, instances []*protobuf.Instance) (*protobuf.TopicResponse, error) {

	logging.Infof("monitorTestProjectorClient.MutationTopicRequest(): start")

	if len(reqTimestamps) == 0 {
		util.TT.Fatal("testProjectorClient.MutationTopicRequest(): reqTimestamps is nil")

	}

	response := new(protobuf.TopicResponse)
	response.Topic = &topic
	response.InstanceIds = make([]uint64, len(instances))
	for i, inst := range instances {
		response.InstanceIds[i] = inst.GetIndexInstance().GetInstId()
	}
	response.ActiveTimestamps = reqTimestamps

	if reqTimestamps[0].GetSeqnos()[10] != 406 {
		response.RollbackTimestamps = make([]*protobuf.TsVbuuid, 1)
		response.RollbackTimestamps[0] = protobuf.NewTsVbuuid(manager.DEFAULT_POOL_NAME, reqTimestamps[0].GetBucket(), manager.NUM_VB)
		response.RollbackTimestamps[0].Append(uint16(10), uint64(406), reqTimestamps[0].Vbuuids[10], 0, 0)

		response.Err = protobuf.NewError(projectorC.ErrorStreamRequest)
		return response, projectorC.ErrorStreamRequest
	} else {
		response.RollbackTimestamps = nil
		response.Err = nil
		return response, nil
	}
}
開發者ID:jchris,項目名稱:indexing,代碼行數:31,代碼來源:stream_monitor_test.go

示例2: RestartVbuckets

func (c *streamEndTestProjectorClient) RestartVbuckets(topic string,
	restartTimestamps []*protobuf.TsVbuuid) (*protobuf.TopicResponse, error) {

	c.sendSync(restartTimestamps)

	response := new(protobuf.TopicResponse)
	response.Topic = &topic
	response.InstanceIds = nil
	response.ActiveTimestamps = make([]*protobuf.TsVbuuid, 1)
	response.ActiveTimestamps[0] = restartTimestamps[0]
	response.RollbackTimestamps = nil
	response.Err = nil

	return response, nil
}
開發者ID:jchris,項目名稱:indexing,代碼行數:15,代碼來源:stream_end_test.go

示例3: MutationTopicRequest

func (c *timerTestProjectorClient) MutationTopicRequest(topic, endpointType string,
	reqTimestamps []*protobuf.TsVbuuid, instances []*protobuf.Instance) (*protobuf.TopicResponse, error) {

	if len(reqTimestamps) == 0 {
		util.TT.Fatal("timerTestProjectorClient.MutationTopicRequest(): reqTimestamps is nil")
	}

	c.sendSync(instances)

	response := new(protobuf.TopicResponse)
	response.Topic = &topic
	response.InstanceIds = make([]uint64, len(instances))
	for i, inst := range instances {
		response.InstanceIds[i] = inst.GetIndexInstance().GetInstId()
	}
	response.ActiveTimestamps = reqTimestamps
	response.RollbackTimestamps = nil
	response.Err = nil

	return response, nil
}
開發者ID:jchris,項目名稱:indexing,代碼行數:21,代碼來源:stream_timer_test.go

示例4: MutationTopicRequest

func (c *deleteTestProjectorClient) MutationTopicRequest(topic, endpointType string,
	reqTimestamps []*protobuf.TsVbuuid, instances []*protobuf.Instance) (*protobuf.TopicResponse, error) {

	if len(reqTimestamps) == 0 {
		util.TT.Fatal("deleteTestProjectorClient.MutationTopicRequest(): reqTimestamps is nil")
	}

	for _, inst := range instances {
		delete_test_status[inst.GetIndexInstance().GetInstId()] = inst
	}

	response := new(protobuf.TopicResponse)
	response.Topic = &topic
	response.InstanceIds = make([]uint64, len(instances))
	for i, inst := range instances {
		response.InstanceIds[i] = inst.GetIndexInstance().GetInstId()
	}

	response.ActiveTimestamps = nil
	for _, ts := range reqTimestamps {
		newTs := protobuf.NewTsVbuuid("default", ts.GetBucket(), manager.NUM_VB)
		if c.server == "127.0.0.1" {
			for i := 0; i < manager.NUM_VB/2; i++ {
				newTs.Append(uint16(i), uint64(i), uint64(1234), uint64(0), uint64(0))
			}
		}
		if c.server == "127.0.0.2" {
			for i := manager.NUM_VB / 2; i < manager.NUM_VB; i++ {
				newTs.Append(uint16(i), uint64(i), uint64(1234), uint64(0), uint64(0))
			}
		}
		response.ActiveTimestamps = append(response.ActiveTimestamps, newTs)
	}

	response.RollbackTimestamps = nil
	response.Err = nil

	return response, nil
}
開發者ID:jchris,項目名稱:indexing,代碼行數:39,代碼來源:stream_delete_test.go


注:本文中的github.com/couchbase/indexing/secondary/protobuf/projector.TopicResponse.Err方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。