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

[query] Query handlers refactoring #2872

Merged
merged 24 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
69e69d5
Initial commit for proposed query handlers refactoring:
soundvibe Nov 11, 2020
1fe3aa1
Merge branch 'master' into linasn/query-handlers-refactoring
soundvibe Nov 11, 2020
5ebcdeb
trying to make linter happy
soundvibe Nov 11, 2020
67814a7
linter fixes
soundvibe Nov 11, 2020
eaddb85
revert old behaviour
soundvibe Nov 11, 2020
3b04c30
Make sure route methods are taken into account when adding and search…
soundvibe Nov 11, 2020
ea121f2
fixed code formatting
soundvibe Nov 11, 2020
dd38ead
[dbnode] Refactor wide query path (#2826)
arnikola Nov 11, 2020
a3bd18a
[dbnode] Introduce Aggregator type (#2840)
linasm Nov 11, 2020
3b5c0ff
[coordinator] Set default namespace tag to avoid colliding with commo…
robskillington Nov 12, 2020
96a5efb
Improve some slow tests (#2881)
vdarulis Nov 12, 2020
9b9c6da
Changes after code review.
soundvibe Nov 12, 2020
78db238
[query] Remove dead code in prom package (#2871)
vpranckaitis Nov 12, 2020
9af0b72
Register separate route for each method.
soundvibe Nov 12, 2020
5814642
linter fixes
soundvibe Nov 12, 2020
a7d6696
removed code duplication in hasndler_test
soundvibe Nov 12, 2020
03f5e35
Merge branch 'master' into linasn/query-handlers-refactoring
soundvibe Nov 12, 2020
3a3a885
Fail if route was already registered.
soundvibe Nov 12, 2020
2d71d9a
formatted code
soundvibe Nov 12, 2020
6b82ce4
Merge branch 'master' into linasn/query-handlers-refactoring
soundvibe Nov 16, 2020
c46d9fd
Update src/query/api/v1/httpd/handler_test.go
soundvibe Nov 16, 2020
ff3a894
Update src/query/api/v1/httpd/handler_test.go
soundvibe Nov 16, 2020
3bc8e4c
More handler tests.
soundvibe Nov 16, 2020
b956426
Merge branch 'master' into linasn/query-handlers-refactoring
soundvibe Nov 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/query/api/v1/handler/database/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ type Handler struct {
instrumentOpts instrument.Options
}

type AddRouteFn func(path string, handler http.Handler, methods ...string)
type addRouteFn func(path string, handler http.Handler, methods ...string)

// RegisterRoutes registers the namespace routes
func RegisterRoutes(
addRoute AddRouteFn,
addRoute addRouteFn,
client clusterclient.Client,
cfg config.Configuration,
embeddedDbCfg *dbconfig.DBConfiguration,
Expand Down
4 changes: 2 additions & 2 deletions src/query/api/v1/handler/namespace/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type Handler struct {
instrumentOpts instrument.Options
}

type AddRouteFn func(path string, handler http.Handler, methods ...string)
type addRouteFn func(path string, handler http.Handler, methods ...string)
soundvibe marked this conversation as resolved.
Show resolved Hide resolved

// Metadata returns the current metadata in the given store and its version
func Metadata(store kv.Store) ([]namespace.Metadata, int, error) {
Expand Down Expand Up @@ -103,7 +103,7 @@ func Metadata(store kv.Store) ([]namespace.Metadata, int, error) {

// RegisterRoutes registers the namespace routes.
func RegisterRoutes(
addRouteFn AddRouteFn,
addRouteFn addRouteFn,
client clusterclient.Client,
clusters m3.Clusters,
defaults []handleroptions.ServiceOptionsDefault,
Expand Down
4 changes: 2 additions & 2 deletions src/query/api/v1/handler/topic/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Handler struct {
instrumentOpts instrument.Options
}

type AddRouteFn func(path string, handler http.Handler, methods ...string)
type addRouteFn func(path string, handler http.Handler, methods ...string)

// Service gets a topic service from m3cluster client
func Service(clusterClient clusterclient.Client, opts handleroptions.ServiceOptions) (topic.Service, error) {
Expand All @@ -71,7 +71,7 @@ func Service(clusterClient clusterclient.Client, opts handleroptions.ServiceOpti

// RegisterRoutes registers the topic routes
func RegisterRoutes(
addRoute AddRouteFn,
addRoute addRouteFn,
client clusterclient.Client,
cfg config.Configuration,
instrumentOpts instrument.Options,
Expand Down
7 changes: 6 additions & 1 deletion src/query/api/v1/httpd/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,12 @@ func (h *Handler) RegisterRoutes() error {
return nil
}

func (h *Handler) addRoute(router *mux.Router, path string, handler http.Handler, methods []string) {
func (h *Handler) addRoute(
router *mux.Router,
path string,
handler http.Handler,
methods []string,
) {
h.addRouteHandlerFn(router, path, handler.ServeHTTP, methods...)
}

Expand Down