本文整理汇总了Golang中protocol.Request.ShardId方法的典型用法代码示例。如果您正苦于以下问题:Golang Request.ShardId方法的具体用法?Golang Request.ShardId怎么用?Golang Request.ShardId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protocol.Request
的用法示例。
在下文中一共展示了Request.ShardId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SyncWrite
func (self *ShardData) SyncWrite(request *p.Request) error {
request.ShardId = &self.id
for _, server := range self.clusterServers {
if err := server.Write(request); err != nil {
return err
}
}
if self.store == nil {
return nil
}
return self.store.Write(request)
}
示例2: Write
func (self *ShardData) Write(request *protocol.Request) error {
request.ShardId = &self.id
requestNumber, err := self.wal.AssignSequenceNumbersAndLog(request, self)
if err != nil {
return err
}
request.RequestNumber = &requestNumber
if self.store != nil {
self.store.BufferWrite(request)
}
for _, server := range self.clusterServers {
server.BufferWrite(request)
}
return nil
}
示例3: Write
func (self *ShardData) Write(request *p.Request) error {
request.ShardId = &self.id
requestNumber, err := self.wal.AssignSequenceNumbersAndLog(request, self)
if err != nil {
return err
}
request.RequestNumber = &requestNumber
if self.store != nil {
self.store.BufferWrite(request)
}
for _, server := range self.clusterServers {
// we have to create a new reqeust object because the ID gets assigned on each server.
requestWithoutId := &p.Request{Type: request.Type, Database: request.Database, MultiSeries: request.MultiSeries, ShardId: &self.id, RequestNumber: request.RequestNumber}
server.BufferWrite(requestWithoutId)
}
return nil
}
示例4: SyncWrite
func (self *ShardData) SyncWrite(request *p.Request, assignSeqNum bool) error {
if assignSeqNum {
self.wal.AssignSequenceNumbers(request)
}
request.ShardId = &self.id
for _, server := range self.clusterServers {
if err := server.Write(request); err != nil {
return err
}
}
if self.store == nil {
return nil
}
return self.store.Write(request)
}