Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
be426b6a
Commit
be426b6a
authored
May 19, 2020
by
邹毅贤
Browse files
Options
Downloads
Patches
Plain Diff
fix review problems
parent
93351409
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
registry/base_registry.go
+9
-10
9 additions, 10 deletions
registry/base_registry.go
with
9 additions
and
10 deletions
registry/base_registry.go
+
9
−
10
View file @
be426b6a
...
@@ -240,7 +240,7 @@ func (r *BaseRegistry) unregister(c common.URL) error {
...
@@ -240,7 +240,7 @@ func (r *BaseRegistry) unregister(c common.URL) error {
return
r
.
processURL
(
c
,
r
.
facadeBasedRegistry
.
DoUnregister
,
nil
)
return
r
.
processURL
(
c
,
r
.
facadeBasedRegistry
.
DoUnregister
,
nil
)
}
}
func
(
r
*
BaseRegistry
)
processURL
(
c
common
.
URL
,
f
func
(
string
,
string
)
error
,
createPathFunc
func
(
dubboPath
string
)
error
)
error
{
func
(
r
*
BaseRegistry
)
processURL
(
c
common
.
URL
,
f
func
(
string
,
string
)
error
,
cpf
createPathFunc
)
error
{
if
f
==
nil
{
if
f
==
nil
{
panic
(
" Must provide a `function(string, string) error` to process URL. "
)
panic
(
" Must provide a `function(string, string) error` to process URL. "
)
}
}
...
@@ -268,9 +268,9 @@ func (r *BaseRegistry) processURL(c common.URL, f func(string, string) error, cr
...
@@ -268,9 +268,9 @@ func (r *BaseRegistry) processURL(c common.URL, f func(string, string) error, cr
switch
role
{
switch
role
{
case
common
.
PROVIDER
:
case
common
.
PROVIDER
:
dubboPath
,
rawURL
,
err
=
r
.
providerRegistry
(
c
,
params
,
c
reatePathFunc
)
dubboPath
,
rawURL
,
err
=
r
.
providerRegistry
(
c
,
params
,
c
pf
)
case
common
.
CONSUMER
:
case
common
.
CONSUMER
:
dubboPath
,
rawURL
,
err
=
r
.
consumerRegistry
(
c
,
params
,
c
reatePathFunc
)
dubboPath
,
rawURL
,
err
=
r
.
consumerRegistry
(
c
,
params
,
c
pf
)
default
:
default
:
return
perrors
.
Errorf
(
"@c{%v} type is not referencer or provider"
,
c
)
return
perrors
.
Errorf
(
"@c{%v} type is not referencer or provider"
,
c
)
}
}
...
@@ -292,7 +292,7 @@ func (r *BaseRegistry) createPath(dubboPath string) error {
...
@@ -292,7 +292,7 @@ func (r *BaseRegistry) createPath(dubboPath string) error {
}
}
// providerRegistry for provider role do
// providerRegistry for provider role do
func
(
r
*
BaseRegistry
)
providerRegistry
(
c
common
.
URL
,
params
url
.
Values
,
createPathFunc
func
(
dubboPath
string
)
error
)
(
string
,
string
,
error
)
{
func
(
r
*
BaseRegistry
)
providerRegistry
(
c
common
.
URL
,
params
url
.
Values
,
f
createPathFunc
)
(
string
,
string
,
error
)
{
var
(
var
(
dubboPath
string
dubboPath
string
rawURL
string
rawURL
string
...
@@ -302,8 +302,8 @@ func (r *BaseRegistry) providerRegistry(c common.URL, params url.Values, createP
...
@@ -302,8 +302,8 @@ func (r *BaseRegistry) providerRegistry(c common.URL, params url.Values, createP
return
""
,
""
,
perrors
.
Errorf
(
"conf{Path:%s, Methods:%s}"
,
c
.
Path
,
c
.
Methods
)
return
""
,
""
,
perrors
.
Errorf
(
"conf{Path:%s, Methods:%s}"
,
c
.
Path
,
c
.
Methods
)
}
}
dubboPath
=
fmt
.
Sprintf
(
"/dubbo/%s/%s"
,
r
.
service
(
c
),
common
.
DubboNodes
[
common
.
PROVIDER
])
dubboPath
=
fmt
.
Sprintf
(
"/dubbo/%s/%s"
,
r
.
service
(
c
),
common
.
DubboNodes
[
common
.
PROVIDER
])
if
createPathFunc
!=
nil
{
if
f
!=
nil
{
err
=
createPathFunc
(
dubboPath
)
err
=
f
(
dubboPath
)
}
}
if
err
!=
nil
{
if
err
!=
nil
{
logger
.
Errorf
(
"facadeBasedRegistry.CreatePath(path{%s}) = error{%#v}"
,
dubboPath
,
perrors
.
WithStack
(
err
))
logger
.
Errorf
(
"facadeBasedRegistry.CreatePath(path{%s}) = error{%#v}"
,
dubboPath
,
perrors
.
WithStack
(
err
))
...
@@ -384,7 +384,7 @@ func (r *BaseRegistry) Subscribe(url *common.URL, notifyListener NotifyListener)
...
@@ -384,7 +384,7 @@ func (r *BaseRegistry) Subscribe(url *common.URL, notifyListener NotifyListener)
n
++
n
++
if
!
r
.
IsAvailable
()
{
if
!
r
.
IsAvailable
()
{
logger
.
Warnf
(
"event listener game over."
)
logger
.
Warnf
(
"event listener game over."
)
return
perrors
.
New
(
"
nacos
Registry is not available."
)
return
perrors
.
New
(
"
Base
Registry is not available."
)
}
}
listener
,
err
:=
r
.
facadeBasedRegistry
.
DoSubscribe
(
url
)
listener
,
err
:=
r
.
facadeBasedRegistry
.
DoSubscribe
(
url
)
...
@@ -417,17 +417,16 @@ func (r *BaseRegistry) Subscribe(url *common.URL, notifyListener NotifyListener)
...
@@ -417,17 +417,16 @@ func (r *BaseRegistry) Subscribe(url *common.URL, notifyListener NotifyListener)
func
(
r
*
BaseRegistry
)
UnSubscribe
(
url
*
common
.
URL
,
notifyListener
NotifyListener
)
error
{
func
(
r
*
BaseRegistry
)
UnSubscribe
(
url
*
common
.
URL
,
notifyListener
NotifyListener
)
error
{
if
!
r
.
IsAvailable
()
{
if
!
r
.
IsAvailable
()
{
logger
.
Warnf
(
"event listener game over."
)
logger
.
Warnf
(
"event listener game over."
)
return
nil
return
perrors
.
New
(
"BaseRegistry is not available."
)
}
}
listener
,
err
:=
r
.
facadeBasedRegistry
.
DoUnsubscribe
(
url
)
listener
,
err
:=
r
.
facadeBasedRegistry
.
DoUnsubscribe
(
url
)
if
err
!=
nil
{
if
err
!=
nil
{
if
!
r
.
IsAvailable
()
{
if
!
r
.
IsAvailable
()
{
logger
.
Warnf
(
"event listener game over."
)
logger
.
Warnf
(
"event listener game over."
)
return
nil
return
perrors
.
New
(
"BaseRegistry is not available."
)
}
}
logger
.
Warnf
(
"getListener() = err:%v"
,
perrors
.
WithStack
(
err
))
logger
.
Warnf
(
"getListener() = err:%v"
,
perrors
.
WithStack
(
err
))
time
.
Sleep
(
time
.
Duration
(
RegistryConnDelay
)
*
time
.
Second
)
return
perrors
.
WithStack
(
err
)
return
perrors
.
WithStack
(
err
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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