Commit dc6fe8df authored by suyanlong's avatar suyanlong

Add Route function

parent 29d525a1
Pipeline #7977 failed with stages
......@@ -212,8 +212,11 @@ func (r *router) isRouter(ibtpx *pb.IBTPX) bool {
return true
}
//TODO
func (r *router) firstRoute(msg *pb.Message) {
panic("implement me")
p := r.portMap.RandRouterPort()
_ = p.AsyncSend(msg)
return
}
func (r *router) getHub() (port.Port, bool) {
......@@ -235,21 +238,25 @@ func (r *router) isEndorse(ibtpx *pb.IBTPX) bool {
func (r *router) HandlerMethod() {}
func (r *router) Single([]string) []port.Port {
panic("implement me")
func (r *router) Single(ids []string) []port.Port {
return r.portMap.RouterPortByID(ids)
}
func (r *router) Multicast([]string) []port.Port {
panic("implement me")
func (r *router) Multicast(ids []string) []port.Port {
return r.portMap.RouterPortByID(ids)
}
func (r *router) Broadcast([]string) []port.Port {
panic("implement me")
return r.portMap.AllRouterPort()
}
func (r *router) Official([]string) []port.Port {
panic("implement me")
func (r *router) Official(tags []string) []port.Port {
var ps []port.Port
for _, tag := range tags {
p := r.portMap.RouterPortByTag(tag)
ps = append(ps, p...)
}
return ps
}
func (r *router) Send(id string, msg *pb.Message) (*pb.Message, error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment