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

Refactor Oasis service for entrypoint #363

Closed
CodeBear801 opened this issue Jul 20, 2020 · 1 comment · Fixed by #365
Closed

Refactor Oasis service for entrypoint #363

CodeBear801 opened this issue Jul 20, 2020 · 1 comment · Fixed by #365

Comments

@CodeBear801
Copy link

CodeBear801 commented Jul 20, 2020

Subtask of #352, more info could go to #352 (comment)

Abstract package named entrypoint(original name is service), which will responsible for
image

image

@CodeBear801
Copy link
Author

CodeBear801 commented Jul 21, 2020

Refactor step1:
For layer of entrypoint

  • Handles external request coming from HTTP, it contains all logic related with Http reading and writing.
  • entrypoint layer will generate oasis.request and calling 'Generator' to generate result ofoasis.Solution
  • Later could support other framework such as grpc, fbswift, gokit, all needed changes should be in this layer
    image

For layer of solution

  • Implements the interface of
	// Generate calculates oasis solutions based on oasis request
	Generate(oasisReq *oasis.Request) (int, []*oasis.Solution, error)

Its major logic described in doc.go

/*
Package solution implements the interface of Generator
 #1. checks whether current energy is sufficient.  Its possible that user could
 directly arrive destination under his energy capacity.

 #2. checks whether could reach destination by one time charge.  The logic for
 calculating one time charge or multiple times charge could be the same.  But
 here we choose to implement specific logic for calculating single charge.
 For original point, with its current capacity, there is a certain range and
 covers x number of charge stations:
 https://user-images.githubusercontent.com/16873751/73227073-1b8d5a80-4127-11ea-81b2-b5cdadcbfff9.png
 And the same for destination, we could draw similar circle but with maximum
 energy capacity of the vehicle:
 https://user-images.githubusercontent.com/16873751/73227100-3790fc00-4127-11ea-813d-80472725bf71.png
 If there is any shared charge staions in both ranges, then we could find most
 optimal solution from them for charge one times

 #3 finds solution for optimal multiple charges based on graph layer
*/

image

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.

1 participant