Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize the design of Router #477

Closed
flycash opened this issue Apr 15, 2020 · 1 comment · Fixed by #630
Closed

Optimize the design of Router #477

flycash opened this issue Apr 15, 2020 · 1 comment · Fixed by #630
Assignees

Comments

@flycash
Copy link
Member

flycash commented Apr 15, 2020

Now the Router has two key interfaces:
image

image

However, we use Chain interface in our codes as the entrance, like:
image

We should notice that, the Router is the top abstraction. Using Chain in codes will reduce the expandability.

So I proposal to refactor the design.

Firstly, we keep the Router interface, but remove the Priority method;
Secondly, we keep Chain interface, but it will implement Router interface, which means that Chain is a Router too but it's more complicated.
Thirdly, we define PriorityRouter which is the Router interface + Priority method;
Finally, we will replace Chain with Router in our codes. The Router instance should be fetched from extension;

The class diagram is:

image

The benefit is that:

  1. User can schedule many routers by their own way, not just Chain;
  2. Only Router interface are exposed outside the Router module;
@zouyx
Copy link
Member

zouyx commented Apr 15, 2020

i will check it later

@zouyx zouyx linked a pull request Jun 24, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants