本文整理汇总了Golang中github.com/couchbase/indexing/secondary/protobuf/projector.TsVbuuid.Union方法的典型用法代码示例。如果您正苦于以下问题:Golang TsVbuuid.Union方法的具体用法?Golang TsVbuuid.Union怎么用?Golang TsVbuuid.Union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/couchbase/indexing/secondary/protobuf/projector.TsVbuuid
的用法示例。
在下文中一共展示了TsVbuuid.Union方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: updateCurrentTsFromResponse
func updateCurrentTsFromResponse(bucket string,
currentTs *protobuf.TsVbuuid, res *protobuf.TimestampResponse) *protobuf.TsVbuuid {
currentTsList := res.GetCurrentTimestamps()
for _, ts := range currentTsList {
if ts != nil && !ts.IsEmpty() && ts.GetBucket() == bucket {
if currentTs == nil {
currentTs = ts.Clone()
} else {
currentTs = currentTs.Union(ts)
}
}
}
return currentTs
}
示例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
}
示例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
}
示例4: runScatter
//.........这里部分代码省略.........
}
}
if msg[3] != nil {
rv := msg[3].(map[string]c.RouterEndpoint)
for raddr, endp := range rv {
fmsg := "%v ##%x updated endpoint %q"
logging.Infof(fmsg, kvdata.logPrefix, opaque, raddr)
kvdata.endpoints[raddr] = endp
}
}
curSeqnos := make(map[uint16]uint64)
if kvdata.engines != nil || kvdata.endpoints != nil {
engines, endpoints := kvdata.engines, kvdata.endpoints
for _, vr := range kvdata.vrs {
curSeqno, err := vr.AddEngines(opaque, engines, endpoints)
if err != nil {
panic(err)
}
curSeqnos[vr.vbno] = curSeqno
}
}
addCount++
respch <- []interface{}{curSeqnos, nil}
case kvCmdDelEngines:
opaque := msg[1].(uint16)
engineKeys := msg[2].([]uint64)
respch := msg[3].(chan []interface{})
for _, vr := range kvdata.vrs {
if err := vr.DeleteEngines(opaque, engineKeys); err != nil {
panic(err)
}
}
for _, engineKey := range engineKeys {
delete(kvdata.engines, engineKey)
fmsg := "%v ##%x deleted engine %q"
logging.Infof(fmsg, kvdata.logPrefix, opaque, engineKey)
}
delCount++
respch <- []interface{}{nil}
case kvCmdTs:
_ /*opaque*/ = msg[1].(uint16)
ts = ts.Union(msg[2].(*protobuf.TsVbuuid))
respch := msg[3].(chan []interface{})
tsCount++
respch <- []interface{}{nil}
case kvCmdGetStats:
respch := msg[1].(chan []interface{})
stats := kvdata.newStats()
stats.Set("events", float64(eventCount))
stats.Set("addInsts", float64(addCount))
stats.Set("delInsts", float64(delCount))
stats.Set("tsCount", float64(tsCount))
statVbuckets := make(map[string]interface{})
for i, vr := range kvdata.vrs {
stats, err := vr.GetStatistics()
if err != nil {
panic(err)
}
statVbuckets[strconv.Itoa(int(i))] = stats
}
stats.Set("vbuckets", statVbuckets)
respch <- []interface{}{map[string]interface{}(stats)}
case kvCmdResetConfig:
config, respch := msg[1].(c.Config), msg[2].(chan []interface{})
if cv, ok := config["syncTimeout"]; ok && heartBeat != nil {
kvdata.syncTimeout = time.Duration(cv.Int())
kvdata.syncTimeout *= time.Millisecond
logging.Infof(
"%v ##%x heart-beat settings reloaded: %v\n",
kvdata.logPrefix, kvdata.opaque, kvdata.syncTimeout)
heartBeat = time.After(kvdata.syncTimeout)
}
for _, vr := range kvdata.vrs {
if err := vr.ResetConfig(config); err != nil {
panic(err)
}
}
kvdata.config = kvdata.config.Override(config)
respch <- []interface{}{nil}
case kvCmdReloadHeartBeat:
respch := msg[1].(chan []interface{})
heartBeat = time.After(kvdata.syncTimeout)
respch <- []interface{}{nil}
case kvCmdClose:
for _, vr := range kvdata.vrs {
vr.Close()
}
respch := msg[1].(chan []interface{})
respch <- []interface{}{nil}
break loop
}
}
}
}