本文整理汇总了Golang中github.com/intelsdi-x/snap/core.Namespace.Key方法的典型用法代码示例。如果您正苦于以下问题:Golang Namespace.Key方法的具体用法?Golang Namespace.Key怎么用?Golang Namespace.Key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/intelsdi-x/snap/core.Namespace
的用法示例。
在下文中一共展示了Namespace.Key方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetQueriedNamespaces
// GetQueriedNamespaces returns all matched metrics namespaces for query 'ns' which can contain
// an asterisk or tuple (refer to query support)
func (mc *metricCatalog) GetQueriedNamespaces(ns core.Namespace) ([]core.Namespace, error) {
mc.mutex.Lock()
defer mc.mutex.Unlock()
// get metric key (might contain wildcard(s))
wkey := ns.Key()
return mc.matchedNamespaces(wkey)
}
示例2: Remove
// Remove removes a metricType from the catalog and from matching map
func (mc *metricCatalog) Remove(ns core.Namespace) {
mc.mutex.Lock()
defer mc.mutex.Unlock()
mc.tree.Remove(ns.Strings())
// remove all items from map mKey mapped for this 'ns'
key := ns.Key()
mc.removeMatchedKey(key)
}
示例3: MatchQuery
// MatchQuery matches given 'ns' which could contain an asterisk or a tuple and add them to matching map under key 'ns'
// The matched metrics namespaces are also returned (as a []core.Namespace)
func (mc *metricCatalog) MatchQuery(ns core.Namespace) ([]core.Namespace, error) {
mc.mutex.Lock()
defer mc.mutex.Unlock()
// get metric key (might contain wildcard(s))
wkey := ns.Key()
// adding matched namespaces to map
mc.addItemToMatchingMap(wkey)
return mc.matchedNamespaces(wkey)
}