mirror of
https://github.com/status-im/consul.git
synced 2025-02-25 11:55:41 +00:00
structs: remove another helper
We already have a helper funtion.
This commit is contained in:
parent
6d72517682
commit
8d8c1f9d5e
@ -3451,8 +3451,8 @@ func updateMeshTopology(tx WriteTxn, idx uint64, node string, svc *structs.NodeS
|
|||||||
oldUpstreams := make(map[structs.ServiceName]bool)
|
oldUpstreams := make(map[structs.ServiceName]bool)
|
||||||
if e, ok := existing.(*structs.ServiceNode); ok {
|
if e, ok := existing.(*structs.ServiceNode); ok {
|
||||||
for _, u := range e.ServiceProxy.Upstreams {
|
for _, u := range e.ServiceProxy.Upstreams {
|
||||||
upstreamMeta := e.NewEnterpriseMetaInPartition(u.DestinationNamespace)
|
upstreamMeta := structs.NewEnterpriseMetaWithPartition(e.PartitionOrDefault(), u.DestinationNamespace)
|
||||||
sn := structs.NewServiceName(u.DestinationName, upstreamMeta)
|
sn := structs.NewServiceName(u.DestinationName, &upstreamMeta)
|
||||||
|
|
||||||
oldUpstreams[sn] = true
|
oldUpstreams[sn] = true
|
||||||
}
|
}
|
||||||
@ -3467,8 +3467,8 @@ func updateMeshTopology(tx WriteTxn, idx uint64, node string, svc *structs.NodeS
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO (freddy): Account for upstream datacenter
|
// TODO (freddy): Account for upstream datacenter
|
||||||
upstreamMeta := svc.NewEnterpriseMetaInPartition(u.DestinationNamespace)
|
upstreamMeta := structs.NewEnterpriseMetaWithPartition(svc.PartitionOrDefault(), u.DestinationNamespace)
|
||||||
upstream := structs.NewServiceName(u.DestinationName, upstreamMeta)
|
upstream := structs.NewServiceName(u.DestinationName, &upstreamMeta)
|
||||||
|
|
||||||
obj, err := tx.First(tableMeshTopology, indexID, upstream, downstream)
|
obj, err := tx.First(tableMeshTopology, indexID, upstream, downstream)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -402,8 +402,8 @@ func (s *Store) discoveryChainTargetsTxn(tx ReadTxn, ws memdb.WatchSet, dc, serv
|
|||||||
|
|
||||||
var resp []structs.ServiceName
|
var resp []structs.ServiceName
|
||||||
for _, t := range chain.Targets {
|
for _, t := range chain.Targets {
|
||||||
em := entMeta.NewEnterpriseMetaInPartition(t.Namespace)
|
em := structs.NewEnterpriseMetaWithPartition(entMeta.PartitionOrDefault(), t.Namespace)
|
||||||
target := structs.NewServiceName(t.Service, em)
|
target := structs.NewServiceName(t.Service, &em)
|
||||||
|
|
||||||
// TODO (freddy): Allow upstream DC and encode in response
|
// TODO (freddy): Allow upstream DC and encode in response
|
||||||
if t.Datacenter == dc {
|
if t.Datacenter == dc {
|
||||||
@ -459,8 +459,8 @@ func (s *Store) discoveryChainSourcesTxn(tx ReadTxn, ws memdb.WatchSet, dc strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, t := range chain.Targets {
|
for _, t := range chain.Targets {
|
||||||
em := sn.NewEnterpriseMetaInPartition(t.Namespace)
|
em := structs.NewEnterpriseMetaWithPartition(sn.PartitionOrDefault(), t.Namespace)
|
||||||
candidate := structs.NewServiceName(t.Service, em)
|
candidate := structs.NewServiceName(t.Service, &em)
|
||||||
|
|
||||||
if !candidate.Matches(destination) {
|
if !candidate.Matches(destination) {
|
||||||
continue
|
continue
|
||||||
|
@ -46,10 +46,6 @@ func (m *EnterpriseMeta) WildcardEnterpriseMetaForPartition() *EnterpriseMeta {
|
|||||||
return &emptyEnterpriseMeta
|
return &emptyEnterpriseMeta
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *EnterpriseMeta) NewEnterpriseMetaInPartition(_ string) *EnterpriseMeta {
|
|
||||||
return &emptyEnterpriseMeta
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(partition): stop using this
|
// TODO(partition): stop using this
|
||||||
func NewEnterpriseMetaInDefaultPartition(_ string) EnterpriseMeta {
|
func NewEnterpriseMetaInDefaultPartition(_ string) EnterpriseMeta {
|
||||||
return emptyEnterpriseMeta
|
return emptyEnterpriseMeta
|
||||||
|
Loading…
x
Reference in New Issue
Block a user