dubbo-go
dubbo-go copied to clipboard
dubbo-go路由接口的改进
在dubbo-go中,PriorityRouter接口定义了URL()方法,但在其实现类中,并没有能够传入这个url的方法,导致实现类的URL()方法只能返回空值,,而在工厂接口PriorityRouterFactory中,定义了NewPriorityRouter() 方法,并且在注释中描述了会带着url创建PriorityRouter,但参数中并没有url。
我认为在接口PriorityRouterFactory的NewPriorityRouter()这个方法中,应该加上url这个参数,并且在后续开发其他规则路由中,也需要这个url获取路由规则以及其他参数。
// dubbo-go/cluster/router/router.go
// PriorityRouterFactory creates priority router with url
type PriorityRouterFactory interface {
// NewPriorityRouter creates router instance with URL
NewPriorityRouter() (PriorityRouter, error)
}
// PriorityRouter routes with priority
type PriorityRouter interface {
// Route Determine the target invokers list.
Route([]protocol.Invoker, *common.URL, protocol.Invocation) []protocol.Invoker
// URL Return URL in router
URL() *common.URL
// Priority Return Priority in router
// 0 to ^int(0) is better
Priority() int64
// Notify the router the invoker list
Notify(invokers []protocol.Invoker)
}
I'm a newbie, can I try it?
Can I have a try?
Can I have a try?
Of course
thinks,Please assign it to me and I will finish it as soon as possible
@FinalT 先跟 @georgehao [hao hong fan] 沟通下,不要上来着急改。这块代码是火山,很容易改出问题。