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
0a49c7b2
Commit
0a49c7b2
authored
5 years ago
by
邹毅贤
Browse files
Options
Downloads
Patches
Plain Diff
remove router chain
parent
1d92adfb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cluster/directory/base_directory.go
+5
-8
5 additions, 8 deletions
cluster/directory/base_directory.go
cluster/router/router_chain/router_chain.go
+0
-49
0 additions, 49 deletions
cluster/router/router_chain/router_chain.go
registry/protocol/protocol.go
+1
-8
1 addition, 8 deletions
registry/protocol/protocol.go
with
6 additions
and
65 deletions
cluster/directory/base_directory.go
+
5
−
8
View file @
0a49c7b2
...
@@ -19,8 +19,6 @@ package directory
...
@@ -19,8 +19,6 @@ package directory
import
(
import
(
"sync"
"sync"
"github.com/apache/dubbo-go/cluster/router/router_chain"
)
)
import
(
import
(
"go.uber.org/atomic"
"go.uber.org/atomic"
...
@@ -36,12 +34,11 @@ import (
...
@@ -36,12 +34,11 @@ import (
var
RouterUrlSet
=
gxset
.
NewSet
()
var
RouterUrlSet
=
gxset
.
NewSet
()
type
BaseDirectory
struct
{
type
BaseDirectory
struct
{
url
*
common
.
URL
url
*
common
.
URL
destroyed
*
atomic
.
Bool
destroyed
*
atomic
.
Bool
routers
[]
cluster
.
Router
routers
[]
cluster
.
Router
mutex
sync
.
Mutex
mutex
sync
.
Mutex
once
sync
.
Once
once
sync
.
Once
routerChain
*
router_chain
.
RouterChain
}
}
func
NewBaseDirectory
(
url
*
common
.
URL
)
BaseDirectory
{
func
NewBaseDirectory
(
url
*
common
.
URL
)
BaseDirectory
{
...
...
This diff is collapsed.
Click to expand it.
cluster/router/router_chain/router_chain.go
deleted
100644 → 0
+
0
−
49
View file @
1d92adfb
package
router_chain
import
(
"sort"
)
import
(
"github.com/apache/dubbo-go/cluster"
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/extension"
"github.com/apache/dubbo-go/protocol"
)
type
RouterChain
struct
{
routers
[]
cluster
.
Router
builtinRouters
[]
cluster
.
Router
Invokers
[]
protocol
.
Invoker
}
func
NewRouterChain
(
url
*
common
.
URL
)
*
RouterChain
{
var
builtinRouters
[]
cluster
.
Router
factories
:=
extension
.
GetRouterFactories
()
for
_
,
factory
:=
range
factories
{
router
,
_
:=
factory
.
Router
(
url
)
builtinRouters
=
append
(
builtinRouters
,
router
)
}
var
routers
[]
cluster
.
Router
copy
(
routers
,
builtinRouters
)
sort
.
SliceStable
(
routers
,
func
(
i
,
j
int
)
bool
{
return
routers
[
i
]
.
Priority
()
<
routers
[
j
]
.
Priority
()
})
return
&
RouterChain
{
builtinRouters
:
builtinRouters
,
routers
:
routers
,
}
}
func
(
r
RouterChain
)
AddRouters
(
routers
[]
cluster
.
Router
)
{
r
.
routers
=
append
(
r
.
routers
,
routers
...
)
sort
.
SliceStable
(
r
.
routers
,
func
(
i
,
j
int
)
bool
{
return
routers
[
i
]
.
Priority
()
<
routers
[
j
]
.
Priority
()
})
}
func
(
r
RouterChain
)
SetInvokers
(
invokers
[]
protocol
.
Invoker
)
{
r
.
Invokers
=
invokers
/*for _, _ := range r.routers {
//router.Notify(r.Invokers)
}*/
}
This diff is collapsed.
Click to expand it.
registry/protocol/protocol.go
+
1
−
8
View file @
0a49c7b2
...
@@ -20,13 +20,10 @@ package protocol
...
@@ -20,13 +20,10 @@ package protocol
import
(
import
(
"strings"
"strings"
"sync"
"sync"
"github.com/apache/dubbo-go/cluster"
"github.com/apache/dubbo-go/cluster/router/router_chain"
)
)
import
(
import
(
gxset
"github.com/dubbogo/gost/container/set"
"github.com/dubbogo/gost/container/
gx
set"
)
)
import
(
import
(
...
@@ -124,10 +121,6 @@ func (proto *registryProtocol) Refer(url common.URL) protocol.Invoker {
...
@@ -124,10 +121,6 @@ func (proto *registryProtocol) Refer(url common.URL) protocol.Invoker {
}
}
go
directory
.
Subscribe
(
serviceUrl
)
go
directory
.
Subscribe
(
serviceUrl
)
chain
:=
router_chain
.
NewRouterChain
(
serviceUrl
)
if
chain
!=
nil
{
//directory.SetRouters(chain.)
}
//new cluster invoker
//new cluster invoker
cluster
:=
extension
.
GetCluster
(
serviceUrl
.
GetParam
(
constant
.
CLUSTER_KEY
,
constant
.
DEFAULT_CLUSTER
))
cluster
:=
extension
.
GetCluster
(
serviceUrl
.
GetParam
(
constant
.
CLUSTER_KEY
,
constant
.
DEFAULT_CLUSTER
))
...
...
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