当前位置: 首页>>代码示例>>Golang>>正文


Golang QuerySpec.ShouldQueryShortTermAndLongTerm方法代码示例

本文整理汇总了Golang中parser.QuerySpec.ShouldQueryShortTermAndLongTerm方法的典型用法代码示例。如果您正苦于以下问题:Golang QuerySpec.ShouldQueryShortTermAndLongTerm方法的具体用法?Golang QuerySpec.ShouldQueryShortTermAndLongTerm怎么用?Golang QuerySpec.ShouldQueryShortTermAndLongTerm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在parser.QuerySpec的用法示例。


在下文中一共展示了QuerySpec.ShouldQueryShortTermAndLongTerm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GetShards

func (self *ClusterConfiguration) GetShards(querySpec *parser.QuerySpec) []*ShardData {
	self.shardsByIdLock.RLock()
	defer self.shardsByIdLock.RUnlock()

	shouldQueryShortTerm, shouldQueryLongTerm := querySpec.ShouldQueryShortTermAndLongTerm()

	if shouldQueryLongTerm && shouldQueryShortTerm {
		shards := make([]*ShardData, 0)
		shards = append(shards, self.getShardRange(querySpec, self.shortTermShards)...)
		shards = append(shards, self.getShardRange(querySpec, self.longTermShards)...)
		if querySpec.IsAscending() {
			SortShardsByTimeAscending(shards)
		} else {
			SortShardsByTimeDescending(shards)
		}
		return shards
	}

	var shards []*ShardData
	if shouldQueryLongTerm {
		shards = self.getShardRange(querySpec, self.longTermShards)
	} else {
		shards = self.getShardRange(querySpec, self.shortTermShards)
	}
	if querySpec.IsAscending() {
		newShards := append([]*ShardData{}, shards...)
		SortShardsByTimeAscending(newShards)
		return newShards
	}
	return shards
}
开发者ID:j0ni,项目名称:influxdb,代码行数:31,代码来源:cluster_configuration.go

示例2: GetShards

func (self *ClusterConfiguration) GetShards(querySpec *parser.QuerySpec) []*ShardData {
	self.shardsByIdLock.RLock()
	defer self.shardsByIdLock.RUnlock()

	if querySpec.IsDropSeriesQuery() {
		seriesName := querySpec.Query().DropSeriesQuery.GetTableName()
		if seriesName[0] < FIRST_LOWER_CASE_CHARACTER {
			return self.longTermShards
		}
		return self.shortTermShards
	}

	shouldQueryShortTerm, shouldQueryLongTerm := querySpec.ShouldQueryShortTermAndLongTerm()

	if shouldQueryLongTerm && shouldQueryShortTerm {
		shards := make([]*ShardData, 0)
		shards = append(shards, self.getShardRange(querySpec, self.shortTermShards)...)
		shards = append(shards, self.getShardRange(querySpec, self.longTermShards)...)
		if querySpec.IsAscending() {
			SortShardsByTimeAscending(shards)
		} else {
			SortShardsByTimeDescending(shards)
		}
		return shards
	}

	var shards []*ShardData
	if shouldQueryLongTerm {
		shards = self.getShardRange(querySpec, self.longTermShards)
	} else {
		shards = self.getShardRange(querySpec, self.shortTermShards)
	}
	if querySpec.IsAscending() {
		newShards := append([]*ShardData{}, shards...)
		SortShardsByTimeAscending(newShards)
		return newShards
	}
	return shards
}
开发者ID:sploit,项目名称:influxdb,代码行数:39,代码来源:cluster_configuration.go


注:本文中的parser.QuerySpec.ShouldQueryShortTermAndLongTerm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。