• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang projector.TopicResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/couchbase/indexing/secondary/protobuf/projector.TopicResponse的典型用法代码示例。如果您正苦于以下问题:Golang TopicResponse类的具体用法?Golang TopicResponse怎么用?Golang TopicResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TopicResponse类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: updateActiveTsFromResponse

func updateActiveTsFromResponse(bucket string,
	activeTs *protobuf.TsVbuuid, res *protobuf.TopicResponse) *protobuf.TsVbuuid {

	activeTsList := res.GetActiveTimestamps()
	for _, ts := range activeTsList {
		if ts != nil && !ts.IsEmpty() && ts.GetBucket() == bucket {
			if activeTs == nil {
				activeTs = ts.Clone()
			} else {
				activeTs = activeTs.Union(ts)
			}
		}
	}
	return activeTs

}
开发者ID:jchris,项目名称:indexing,代码行数:16,代码来源:kv_sender.go


示例3: updateRollbackTsFromResponse

func updateRollbackTsFromResponse(bucket string,
	rollbackTs *protobuf.TsVbuuid, res *protobuf.TopicResponse) *protobuf.TsVbuuid {

	rollbackTsList := res.GetRollbackTimestamps()
	for _, ts := range rollbackTsList {
		if ts != nil && !ts.IsEmpty() && ts.GetBucket() == bucket {
			if rollbackTs == nil {
				rollbackTs = ts.Clone()
			} else {
				rollbackTs = rollbackTs.Union(ts)
			}
		}
	}

	return rollbackTs

}
开发者ID:jchris,项目名称:indexing,代码行数:17,代码来源:kv_sender.go


示例4: shouldRetryAddInstances

//
// Handle error for adding instance.  The following error can be returned from projector:
// 1) Unconditional Recoverable error by worker
//      * generic http error
//      * ErrorStreamRequest
//      * ErrorResposneTimeout
//      * ErrorFeeder
// 2) Non Recoverable error
//      * ErrorInconsistentFeed
// 3) Recoverable error by other worker
//      * ErrorInvalidVbucketBranch
//      * ErrorNotMyVbucket
//      * ErrorInvalidKVaddrs
// 4) Error that may not need retry
//      * ErrorTopicExist
//
func (worker *adminWorker) shouldRetryAddInstances(requestTs []*protobuf.TsVbuuid,
	response *protobuf.TopicResponse,
	err error) ([]*protobuf.TsVbuuid, error) {

	logging.Debugf("adminWorker::shouldRetryAddInstances(): start")

	// First of all, let's check for any non-recoverable error.
	errStr := err.Error()
	logging.Debugf("adminWorker::shouldRetryAddInstances(): Error encountered when calling MutationTopicRequest. Error=%v", errStr)

	if strings.Contains(errStr, projectorC.ErrorTopicExist.Error()) {
		// TODO: Need pratap to define the semantic of ErrorTopExist.   Right now return as an non-recoverable error.
		return nil, NewError(ERROR_STREAM_REQUEST_ERROR, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorInconsistentFeed.Error()) {
		// This is fatal error.  Should only happen due to coding error.   Need to return this error.
		// For those projectors that have already been opened, let's leave it open. Eventually those
		// projectors will fill up the buffer and terminate the connection by itself.
		return nil, NewError(ERROR_STREAM_REQUEST_ERROR, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorNotMyVbucket.Error()) {
		return nil, NewError(ERROR_STREAM_WRONG_VBUCKET, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorInvalidVbucketBranch.Error()) {
		return nil, NewError(ERROR_STREAM_INVALID_TIMESTAMP, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorInvalidKVaddrs.Error()) {
		return nil, NewError(ERROR_STREAM_INVALID_KVADDRS, NORMAL, STREAM, err, "")
	}

	// There is no non-recoverable error, so we can retry.  For retry, recompute the new set of timestamps based on the response.
	rollbackTimestamps := response.GetRollbackTimestamps()
	var newRequestTs []*protobuf.TsVbuuid = nil
	for _, ts := range requestTs {
		ts = recomputeRequestTimestamp(ts, rollbackTimestamps)
		newRequestTs = append(newRequestTs, ts)
	}

	return newRequestTs, nil
}
开发者ID:jchris,项目名称:indexing,代码行数:56,代码来源:stream_admin.go


示例5: shouldRetryRestartVbuckets

//
// Handle error for restart vbuckets.  The following error can be returned from projector:
// 1) Unconditional Recoverable error by worker
//      * generic http error
//      * ErrorStreamRequest
//      * ErrorResposneTimeout
// 2) Non Recoverable error
//      * ErrorTopicMissing
//      * ErrorInvalidBucket
// 3) Recoverable error by other worker
//      * ErrorInvalidVbucketBranch
//      * ErrorNotMyVbucket
//      * ErrorFeeder
//      * ErrorStreamEnd
//
func (worker *adminWorker) shouldRetryRestartVbuckets(requestTs []*protobuf.TsVbuuid,
	response *protobuf.TopicResponse,
	err error) ([]*protobuf.TsVbuuid, error) {

	logging.Debugf("adminWorker::shouldRetryRestartVbuckets(): start")

	// First of all, let's check for any non-recoverable error.
	errStr := err.Error()
	logging.Debugf("adminWorker::shouldRetryRestartVbuckets(): Error encountered when calling RestartVbuckets. Error=%v", errStr)

	if strings.Contains(errStr, projectorC.ErrorTopicMissing.Error()) {
		return nil, NewError(ERROR_STREAM_REQUEST_ERROR, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorInvalidBucket.Error()) {
		return nil, NewError(ERROR_STREAM_REQUEST_ERROR, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorFeeder.Error()) {
		return nil, NewError(ERROR_STREAM_FEEDER, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorNotMyVbucket.Error()) {
		return nil, NewError(ERROR_STREAM_WRONG_VBUCKET, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorInvalidVbucketBranch.Error()) {
		return nil, NewError(ERROR_STREAM_INVALID_TIMESTAMP, NORMAL, STREAM, err, "")

	} else if strings.Contains(errStr, projectorC.ErrorStreamEnd.Error()) {
		return nil, NewError(ERROR_STREAM_STREAM_END, NORMAL, STREAM, err, "")
	}

	// There is no non-recoverable error, so we can retry.  For retry, recompute the new set of timestamps based on the response.
	rollbackTimestamps := response.GetRollbackTimestamps()
	var newRequestTs []*protobuf.TsVbuuid = nil
	for _, ts := range requestTs {
		ts = recomputeRequestTimestamp(ts, rollbackTimestamps)
		newRequestTs = append(newRequestTs, ts)
	}

	return newRequestTs, nil
}
开发者ID:jchris,项目名称:indexing,代码行数:54,代码来源:stream_admin.go


示例6: 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


示例7: 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


示例8: 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



注:本文中的github.com/couchbase/indexing/secondary/protobuf/projector.TopicResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang projector.TsVbuuid类代码示例发布时间:2022-05-23
下一篇:
Golang manager.IndexManager类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap