本文整理匯總了Golang中github.com/Wikia/influxdb/protocol.Request.GetShardId方法的典型用法代碼示例。如果您正苦於以下問題:Golang Request.GetShardId方法的具體用法?Golang Request.GetShardId怎麽用?Golang Request.GetShardId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Wikia/influxdb/protocol.Request
的用法示例。
在下文中一共展示了Request.GetShardId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Write
// This method never blocks. It'll buffer writes until they fill the buffer then drop the on the
// floor and let the background goroutine replay from the WAL
func (self *WriteBuffer) Write(request *protocol.Request) {
self.shardLastRequestNumber[request.GetShardId()] = request.GetRequestNumber()
select {
case self.writes <- request:
log.Debug("Buffering %d:%d for %s", request.GetRequestNumber(), request.GetShardId(), self.writerInfo)
return
default:
select {
case self.stoppedWrites <- *request.RequestNumber:
return
default:
return
}
}
}
示例2: write
func (self *WriteBuffer) write(request *protocol.Request) {
attempts := 0
for {
self.shardIds[*request.ShardId] = true
err := self.writer.Write(request)
if err == nil {
requestNumber := request.RequestNumber
if requestNumber == nil {
return
}
self.shardCommitedRequestNumber[request.GetShardId()] = *requestNumber
log.Debug("Commiting %d:%d for %s", request.GetRequestNumber(), request.GetShardId(), self.writerInfo)
self.wal.Commit(*requestNumber, self.serverId)
return
}
if attempts%100 == 0 {
log.Error("%s: WriteBuffer: error on write to server %d: %s", self.writerInfo, self.serverId, err)
}
attempts += 1
// backoff happens in the writer, just sleep for a small fixed amount of time before retrying
time.Sleep(time.Millisecond * 100)
}
}