-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
http: add handler_base::verify_mandatory_params() #2084
Conversation
include/seastar/http/handlers.hh
Outdated
@@ -66,8 +67,7 @@ public: | |||
return *this; | |||
} | |||
|
|||
std::vector<sstring> _mandatory_param; | |||
|
|||
friend class routes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This caught my eye. I think it's better to get const getter for _mandatory_param reference, or move the verify_param() helper to be handler_base's method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i plan to stuff move info into _mandatory_param
, so we can verify the type of the params right in seastar, instead of in the higher application level. so the const getter is a no-go, as it exposes the internals to the public. so i am repurposing this PR to go with the 2nd route.
before this change, this member function was a free function called by `routes::handle()`, but since `handler_base` is closer to the `_mandatory_param` and in the following change, we will store the expected param types in `_mandatory_param`, this makes `handler_base` a better home for the verification function. so to prepare for the change, let's move this free function into handler_base. also, let's mark `_mandatory_param` private, allows us to store the typing of the params into `_mandatory_param`. as this variable should not be visible from the outer world. and the typing information should be opaque from the caller. Refs scylladb#2082 Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
185957e
to
6e8f835
Compare
v2:
|
before this change, this member function was a free function called by `routes::handle()`, but since `handler_base` is closer to the `_mandatory_param` and in the following change, we will store the expected param types in `_mandatory_param`, this makes `handler_base` a better home for the verification function. so to prepare for the change, let's move this free function into handler_base. also, let's mark `_mandatory_param` private, allows us to store the typing of the params into `_mandatory_param`. as this variable should not be visible from the outer world. and the typing information should be opaque from the caller. Refs scylladb#2082 Signed-off-by: Kefu Chai <kefu.chai@scylladb.com> Closes scylladb#2084
before this change, this member function was a free function called
by
routes::handle()
, but sincehandler_base
is closer to the_mandatory_param
and in the following change, we will storethe expected param types in
_mandatory_param
, this makeshandler_base
a better home for the verification function. so toprepare for the change, let's move this free function into handler_base.
also, let's mark
_mandatory_param
private, allows us to store thetyping of the params into
_mandatory_param
. as this variable shouldnot be visible from the outer world. and the typing information should
be opaque from the caller.
Refs #2082
Signed-off-by: Kefu Chai kefu.chai@scylladb.com