Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
a23c6d23
Commit
a23c6d23
authored
4 years ago
by
xg.gao
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
f00d104b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
metadata/report/consul/report.go
+6
-16
6 additions, 16 deletions
metadata/report/consul/report.go
metadata/report/nacos/report.go
+5
-5
5 additions, 5 deletions
metadata/report/nacos/report.go
metadata/report/zookeeper/report.go
+6
-15
6 additions, 15 deletions
metadata/report/zookeeper/report.go
with
17 additions
and
36 deletions
metadata/report/consul/report.go
+
6
−
16
View file @
a23c6d23
...
...
@@ -34,8 +34,9 @@ var (
)
func
init
()
{
mf
:=
&
consulMetadataReportFactory
{}
extension
.
SetMetadataReportFactory
(
"consul"
,
func
()
factory
.
MetadataReportFactory
{
return
&
consulMetadataReportFactory
{}
return
mf
})
}
...
...
@@ -77,13 +78,9 @@ func (m *consulMetadataReport) RemoveServiceMetadata(metadataIdentifier *identif
func
(
m
*
consulMetadataReport
)
GetExportedURLs
(
metadataIdentifier
*
identifier
.
ServiceMetadataIdentifier
)
([]
string
,
error
)
{
k
:=
metadataIdentifier
.
GetIdentifierKey
()
kv
,
_
,
err
:=
m
.
client
.
KV
()
.
Get
(
k
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
||
kv
==
nil
{
return
emptyStrSlice
,
err
}
if
kv
==
nil
{
return
emptyStrSlice
,
nil
}
return
[]
string
{
string
(
kv
.
Value
)},
nil
}
...
...
@@ -98,13 +95,9 @@ func (m *consulMetadataReport) SaveSubscribedData(subscriberMetadataIdentifier *
func
(
m
*
consulMetadataReport
)
GetSubscribedURLs
(
subscriberMetadataIdentifier
*
identifier
.
SubscriberMetadataIdentifier
)
([]
string
,
error
)
{
k
:=
subscriberMetadataIdentifier
.
GetIdentifierKey
()
kv
,
_
,
err
:=
m
.
client
.
KV
()
.
Get
(
k
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
||
kv
==
nil
{
return
emptyStrSlice
,
err
}
if
kv
==
nil
{
return
emptyStrSlice
,
nil
}
return
[]
string
{
string
(
kv
.
Value
)},
nil
}
...
...
@@ -112,19 +105,16 @@ func (m *consulMetadataReport) GetSubscribedURLs(subscriberMetadataIdentifier *i
func
(
m
*
consulMetadataReport
)
GetServiceDefinition
(
metadataIdentifier
*
identifier
.
MetadataIdentifier
)
(
string
,
error
)
{
k
:=
metadataIdentifier
.
GetIdentifierKey
()
kv
,
_
,
err
:=
m
.
client
.
KV
()
.
Get
(
k
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
||
kv
==
nil
{
return
""
,
err
}
if
kv
==
nil
{
return
""
,
nil
}
return
string
(
kv
.
Value
),
nil
}
type
consulMetadataReportFactory
struct
{
}
// nolint
func
(
mf
*
consulMetadataReportFactory
)
CreateMetadataReport
(
url
*
common
.
URL
)
report
.
MetadataReport
{
config
:=
&
consul
.
Config
{
Address
:
url
.
Location
}
client
,
err
:=
consul
.
NewClient
(
config
)
...
...
This diff is collapsed.
Click to expand it.
metadata/report/nacos/report.go
+
5
−
5
View file @
a23c6d23
...
...
@@ -38,8 +38,9 @@ import (
)
func
init
()
{
mf
:=
&
nacosMetadataReportFactory
{}
extension
.
SetMetadataReportFactory
(
"nacos"
,
func
()
factory
.
MetadataReportFactory
{
return
&
nacosMetadataReportFactory
{}
return
mf
})
}
...
...
@@ -148,18 +149,16 @@ func (n *nacosMetadataReport) getConfigAsArray(param vo.ConfigParam) ([]string,
res
:=
make
([]
string
,
0
,
1
)
cfg
,
err
:=
n
.
getConfig
(
param
)
if
err
!=
nil
{
if
err
!=
nil
||
len
(
cfg
)
==
0
{
return
res
,
err
}
if
len
(
cfg
)
==
0
{
return
res
,
nil
}
decodeCfg
,
err
:=
url
.
QueryUnescape
(
cfg
)
if
err
!=
nil
{
logger
.
Errorf
(
"The config is invalid: %s"
,
cfg
)
return
res
,
err
}
res
=
append
(
res
,
decodeCfg
)
return
res
,
nil
}
...
...
@@ -177,6 +176,7 @@ func (n *nacosMetadataReport) getConfig(param vo.ConfigParam) (string, error) {
type
nacosMetadataReportFactory
struct
{
}
// nolint
func
(
n
*
nacosMetadataReportFactory
)
CreateMetadataReport
(
url
*
common
.
URL
)
report
.
MetadataReport
{
client
,
err
:=
nacos
.
NewNacosConfigClient
(
url
)
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
metadata/report/zookeeper/report.go
+
6
−
15
View file @
a23c6d23
...
...
@@ -37,8 +37,9 @@ var (
)
func
init
()
{
mf
:=
&
zookeeperMetadataReportFactory
{}
extension
.
SetMetadataReportFactory
(
"zookeeper"
,
func
()
factory
.
MetadataReportFactory
{
return
&
zookeeperMetadataReportFactory
{}
return
mf
})
}
...
...
@@ -77,13 +78,9 @@ func (m *zookeeperMetadataReport) RemoveServiceMetadata(metadataIdentifier *iden
func
(
m
*
zookeeperMetadataReport
)
GetExportedURLs
(
metadataIdentifier
*
identifier
.
ServiceMetadataIdentifier
)
([]
string
,
error
)
{
k
:=
m
.
rootDir
+
metadataIdentifier
.
GetFilePathKey
()
v
,
_
,
err
:=
m
.
client
.
GetContent
(
k
)
if
err
!=
nil
{
if
err
!=
nil
||
len
(
v
)
==
0
{
return
emptyStrSlice
,
err
}
if
len
(
v
)
==
0
{
return
emptyStrSlice
,
nil
}
return
[]
string
{
string
(
v
)},
nil
}
...
...
@@ -97,13 +94,9 @@ func (m *zookeeperMetadataReport) SaveSubscribedData(subscriberMetadataIdentifie
func
(
m
*
zookeeperMetadataReport
)
GetSubscribedURLs
(
subscriberMetadataIdentifier
*
identifier
.
SubscriberMetadataIdentifier
)
([]
string
,
error
)
{
k
:=
m
.
rootDir
+
subscriberMetadataIdentifier
.
GetFilePathKey
()
v
,
_
,
err
:=
m
.
client
.
GetContent
(
k
)
if
err
!=
nil
{
if
err
!=
nil
||
len
(
v
)
==
0
{
return
emptyStrSlice
,
err
}
if
len
(
v
)
==
0
{
return
emptyStrSlice
,
nil
}
return
[]
string
{
string
(
v
)},
nil
}
...
...
@@ -111,15 +104,13 @@ func (m *zookeeperMetadataReport) GetSubscribedURLs(subscriberMetadataIdentifier
func
(
m
*
zookeeperMetadataReport
)
GetServiceDefinition
(
metadataIdentifier
*
identifier
.
MetadataIdentifier
)
(
string
,
error
)
{
k
:=
m
.
rootDir
+
metadataIdentifier
.
GetFilePathKey
()
v
,
_
,
err
:=
m
.
client
.
GetContent
(
k
)
if
err
!=
nil
{
return
""
,
err
}
return
string
(
v
),
nil
return
string
(
v
),
err
}
type
zookeeperMetadataReportFactory
struct
{
}
// nolint
func
(
mf
*
zookeeperMetadataReportFactory
)
CreateMetadataReport
(
url
*
common
.
URL
)
report
.
MetadataReport
{
client
,
err
:=
zookeeper
.
NewZookeeperClient
(
"zookeeperMetadataReport"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment