Skip to content

Commit

Permalink
fix:区分metadaata的key类型
Browse files Browse the repository at this point in the history
  • Loading branch information
dongsheng.qi committed Oct 31, 2023
1 parent a04b36b commit 028f718
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/model/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ type ServiceClusters interface {
type LocationBasedMetaKey struct {
location Location
metaKey string
keyType int // 0: equal, 1: not equal
}

// metaDataInService 标签缓存信息
Expand Down Expand Up @@ -1017,10 +1018,10 @@ func (c *clusterCache) SetExtendedCacheValue(pluginIndex int, value interface{})
}

// GetInstancesWithMetaValuesNotEqual 获取该标签不等于指定标签值的实例集合
func (c *clusterCache) GetInstancesWithMetaValuesNotEqual(location Location, metaKey string, metavalue string) map[string]string {
func (c *clusterCache) GetInstancesWithMetaValuesNotEqual(location Location, metaKey string, metaValue string) map[string]string {
var value interface{}
var exists bool
locationKey := LocationBasedMetaKey{location: location, metaKey: metaKey}
locationKey := LocationBasedMetaKey{location: location, metaKey: metaKey, keyType: 1}
value, exists = c.svcLevelMetadata.metaDataSet.Load(locationKey)
if exists {
return value.(map[string]string)
Expand All @@ -1043,7 +1044,7 @@ func (c *clusterCache) GetInstancesWithMetaValuesNotEqual(location Location, met
if !ok {
continue
}
if val == metavalue {
if val == metaValue {
continue
}
metaValueSet[val] = buildComposedValue(metaKey, val)
Expand Down

0 comments on commit 028f718

Please sign in to comment.