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

Expose route for context #1128

Merged
merged 3 commits into from
Nov 8, 2023
Merged

Conversation

xxx7xxxx
Copy link
Contributor

@xxx7xxxx xxx7xxxx commented Nov 1, 2023

Have tried to design a universal exposed route type system which is complicated and unnecessary, so I turned to the minimum way to implement the current requirement.

Will try to update Gateway API to v1.0.0(GA), there's tons of broken dependencies to fix...

@codecov-commenter
Copy link

codecov-commenter commented Nov 1, 2023

Codecov Report

Attention: 39 lines in your changes are missing coverage. Please review.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files Coverage Δ
pkg/object/httpserver/mux.go 80.79% <100.00%> (+0.11%) ⬆️
pkg/object/httpserver/routers/routers.go 100.00% <ø> (ø)
pkg/object/httpserver/routers/spec.go 96.55% <0.00%> (-3.45%) ⬇️
pkg/filters/redirectorv2/redirectorv2.go 67.00% <67.00%> (ø)

... and 2 files with indirect coverage changes

📢 Thoughts on this report? Let us know!.

suchen-sci
suchen-sci previously approved these changes Nov 6, 2023
@@ -92,6 +94,16 @@ func New(span *tracing.Span) *Context {
return ctx
}

// SetRoute sets the route.
func (ctx *Context) SetRoute(route routers.Route) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this context contains general protocol for multiple protocols. Such as HTTP, GRPC... Maybe update this name to SetHTTPRoute, GetHTTPRoute or make the route interface{} SetRoute(protocols.Route)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

pkg/filters/redirectorv2/redirectorv2.go Show resolved Hide resolved
@@ -25,6 +25,7 @@ import (

"github.com/megaease/easegress/v2/pkg/context"
"github.com/megaease/easegress/v2/pkg/filters"
httprouters "github.com/megaease/easegress/v2/pkg/object/httpserver/routers"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just a little advice. How about add a type alias in github.com/megaease/easegress/v2/pkg/protocols/httpprot say:

var Route = github.com/megaease/easegress/v2/pkg/object/httpserver/routers.Route

then

prefix := route.(httpprot.Route).GetPathPrefix()

The code produce exactly same result. But for future developers, it may a little bit easier for them to find right interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will cause an import cycle.

@suchen-sci suchen-sci added this pull request to the merge queue Nov 8, 2023
Merged via the queue into easegress-io:main with commit 1c0e586 Nov 8, 2023
8 checks passed
@xxx7xxxx xxx7xxxx deleted the redirectorv2 branch November 8, 2023 04:02
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 this pull request may close these issues.

None yet

3 participants