本文整理匯總了Golang中github.com/influxdb/influxdb/engine.Processor.Close方法的典型用法代碼示例。如果您正苦於以下問題:Golang Processor.Close方法的具體用法?Golang Processor.Close怎麽用?Golang Processor.Close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/influxdb/influxdb/engine.Processor
的用法示例。
在下文中一共展示了Processor.Close方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Query
func (self *ShardData) Query(querySpec *parser.QuerySpec, response chan<- *p.Response) {
log.Debug("QUERY: shard %d, query '%s'", self.Id(), querySpec.GetQueryStringWithTimeCondition())
defer common.RecoverFunc(querySpec.Database(), querySpec.GetQueryStringWithTimeCondition(), func(err interface{}) {
response <- &p.Response{
Type: p.Response_ERROR.Enum(),
ErrorMessage: p.String(fmt.Sprintf("%s", err)),
}
})
// This is only for queries that are deletes or drops. They need to be sent everywhere as opposed to just the local or one of the remote shards.
// But this boolean should only be set to true on the server that receives the initial query.
if querySpec.RunAgainstAllServersInShard {
if querySpec.IsDeleteFromSeriesQuery() {
self.logAndHandleDeleteQuery(querySpec, response)
} else if querySpec.IsDropSeriesQuery() {
self.logAndHandleDropSeriesQuery(querySpec, response)
}
}
if self.IsLocal {
var processor engine.Processor = NewResponseChannelProcessor(NewResponseChannelWrapper(response))
var err error
processor = NewShardIdInserterProcessor(self.Id(), processor)
processor, err = self.getProcessor(querySpec, processor)
if err != nil {
response <- &p.Response{
Type: p.Response_ERROR.Enum(),
ErrorMessage: p.String(err.Error()),
}
log.Error("Error while creating engine: %s", err)
return
}
shard, err := self.store.GetOrCreateShard(self.id)
if err != nil {
response <- &p.Response{
Type: p.Response_ERROR.Enum(),
ErrorMessage: p.String(err.Error()),
}
log.Error("Error while getting shards: %s", err)
return
}
defer self.store.ReturnShard(self.id)
log.Debug("Processor chain: %s\n", engine.ProcessorChain(processor))
err = shard.Query(querySpec, processor)
// if we call Close() in case of an error it will mask the error
if err != nil {
response <- &p.Response{
Type: p.Response_ERROR.Enum(),
ErrorMessage: p.String(err.Error()),
}
return
}
processor.Close()
response <- &p.Response{Type: p.Response_END_STREAM.Enum()}
return
}
if server := self.randomHealthyServer(); server != nil {
log.Debug("Querying server %d for shard %d", server.GetId(), self.Id())
request := self.createRequest(querySpec)
server.MakeRequest(request, response)
return
}
message := fmt.Sprintf("No servers up to query shard %d", self.id)
response <- &p.Response{
Type: p.Response_ERROR.Enum(),
ErrorMessage: &message,
}
log.Error(message)
}