mirror of https://github.com/status-im/consul.git
Merge pull request #9805 from hashicorp/dnephin/remove-ent-meta-get-namespace
structs: remove EnterpriseMeta.GetNamespace
This commit is contained in:
commit
08e610b37c
|
@ -75,7 +75,7 @@ func (c *StreamingHealthServices) Fetch(opts cache.FetchOptions, req cache.Reque
|
||||||
Token: srvReq.Token,
|
Token: srvReq.Token,
|
||||||
Datacenter: srvReq.Datacenter,
|
Datacenter: srvReq.Datacenter,
|
||||||
Index: index,
|
Index: index,
|
||||||
Namespace: srvReq.EnterpriseMeta.GetNamespace(),
|
Namespace: srvReq.EnterpriseMeta.NamespaceOrEmpty(),
|
||||||
}
|
}
|
||||||
if srvReq.Connect {
|
if srvReq.Connect {
|
||||||
req.Topic = pbsubscribe.Topic_ServiceHealthConnect
|
req.Topic = pbsubscribe.Topic_ServiceHealthConnect
|
||||||
|
|
|
@ -229,7 +229,7 @@ func requireResultsSame(t *testing.T, want, got *structs.IndexedCheckServiceNode
|
||||||
// without duplicating the tests.
|
// without duplicating the tests.
|
||||||
func getNamespace(ns string) string {
|
func getNamespace(ns string) string {
|
||||||
meta := structs.NewEnterpriseMeta(ns)
|
meta := structs.NewEnterpriseMeta(ns)
|
||||||
return meta.GetNamespace()
|
return meta.NamespaceOrEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderingConsistentWithMemDb(t *testing.T) {
|
func TestOrderingConsistentWithMemDb(t *testing.T) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ func (e EventPayloadCheckServiceNode) MatchesKey(key, namespace string) bool {
|
||||||
if e.overrideKey != "" {
|
if e.overrideKey != "" {
|
||||||
name = e.overrideKey
|
name = e.overrideKey
|
||||||
}
|
}
|
||||||
ns := e.Value.Service.EnterpriseMeta.GetNamespace()
|
ns := e.Value.Service.EnterpriseMeta.NamespaceOrDefault()
|
||||||
if e.overrideNamespace != "" {
|
if e.overrideNamespace != "" {
|
||||||
ns = e.overrideNamespace
|
ns = e.overrideNamespace
|
||||||
}
|
}
|
||||||
|
@ -315,8 +315,8 @@ func ServiceHealthEventsFromChanges(tx ReadTxn, changes Changes) ([]stream.Event
|
||||||
e.Topic = topicServiceHealthConnect
|
e.Topic = topicServiceHealthConnect
|
||||||
payload := e.Payload.(EventPayloadCheckServiceNode)
|
payload := e.Payload.(EventPayloadCheckServiceNode)
|
||||||
payload.overrideKey = serviceName.Name
|
payload.overrideKey = serviceName.Name
|
||||||
if gatewayName.EnterpriseMeta.GetNamespace() != serviceName.EnterpriseMeta.GetNamespace() {
|
if gatewayName.EnterpriseMeta.NamespaceOrDefault() != serviceName.EnterpriseMeta.NamespaceOrDefault() {
|
||||||
payload.overrideNamespace = serviceName.EnterpriseMeta.GetNamespace()
|
payload.overrideNamespace = serviceName.EnterpriseMeta.NamespaceOrDefault()
|
||||||
}
|
}
|
||||||
e.Payload = payload
|
e.Payload = payload
|
||||||
|
|
||||||
|
@ -339,8 +339,8 @@ func ServiceHealthEventsFromChanges(tx ReadTxn, changes Changes) ([]stream.Event
|
||||||
e.Topic = topicServiceHealthConnect
|
e.Topic = topicServiceHealthConnect
|
||||||
payload := e.Payload.(EventPayloadCheckServiceNode)
|
payload := e.Payload.(EventPayloadCheckServiceNode)
|
||||||
payload.overrideKey = serviceName.Name
|
payload.overrideKey = serviceName.Name
|
||||||
if gatewayName.EnterpriseMeta.GetNamespace() != serviceName.EnterpriseMeta.GetNamespace() {
|
if gatewayName.EnterpriseMeta.NamespaceOrDefault() != serviceName.EnterpriseMeta.NamespaceOrDefault() {
|
||||||
payload.overrideNamespace = serviceName.EnterpriseMeta.GetNamespace()
|
payload.overrideNamespace = serviceName.EnterpriseMeta.NamespaceOrDefault()
|
||||||
}
|
}
|
||||||
e.Payload = payload
|
e.Payload = payload
|
||||||
|
|
||||||
|
@ -470,8 +470,8 @@ func copyEventForService(event stream.Event, service structs.ServiceName) stream
|
||||||
event.Topic = topicServiceHealthConnect
|
event.Topic = topicServiceHealthConnect
|
||||||
payload := event.Payload.(EventPayloadCheckServiceNode)
|
payload := event.Payload.(EventPayloadCheckServiceNode)
|
||||||
payload.overrideKey = service.Name
|
payload.overrideKey = service.Name
|
||||||
if payload.Value.Service.EnterpriseMeta.GetNamespace() != service.EnterpriseMeta.GetNamespace() {
|
if payload.Value.Service.EnterpriseMeta.NamespaceOrDefault() != service.EnterpriseMeta.NamespaceOrDefault() {
|
||||||
payload.overrideNamespace = service.EnterpriseMeta.GetNamespace()
|
payload.overrideNamespace = service.EnterpriseMeta.NamespaceOrDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
event.Payload = payload
|
event.Payload = payload
|
||||||
|
|
|
@ -1666,7 +1666,7 @@ var cmpPartialOrderEvents = cmp.Options{
|
||||||
if payload.overrideKey != "" {
|
if payload.overrideKey != "" {
|
||||||
name = payload.overrideKey
|
name = payload.overrideKey
|
||||||
}
|
}
|
||||||
ns := csn.Service.EnterpriseMeta.GetNamespace()
|
ns := csn.Service.EnterpriseMeta.NamespaceOrDefault()
|
||||||
if payload.overrideNamespace != "" {
|
if payload.overrideNamespace != "" {
|
||||||
ns = payload.overrideNamespace
|
ns = payload.overrideNamespace
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ func toStreamSubscribeRequest(req *pbsubscribe.SubscribeRequest, entMeta structs
|
||||||
Key: req.Key,
|
Key: req.Key,
|
||||||
Token: req.Token,
|
Token: req.Token,
|
||||||
Index: req.Index,
|
Index: req.Index,
|
||||||
Namespace: entMeta.GetNamespace(),
|
Namespace: entMeta.NamespaceOrEmpty(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,11 +74,6 @@ func (_ *EnterpriseMeta) FillAuthzContext(_ *acl.AuthorizerContext) {}
|
||||||
|
|
||||||
func (_ *EnterpriseMeta) Normalize() {}
|
func (_ *EnterpriseMeta) Normalize() {}
|
||||||
|
|
||||||
// GetNamespace always returns the empty string.
|
|
||||||
func (_ *EnterpriseMeta) GetNamespace() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// FillAuthzContext stub
|
// FillAuthzContext stub
|
||||||
func (_ *DirEntry) FillAuthzContext(_ *acl.AuthorizerContext) {}
|
func (_ *DirEntry) FillAuthzContext(_ *acl.AuthorizerContext) {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue