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

chore(volo-http): refactor config of context #387

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

wfly1998
Copy link
Member

Motivation

The previous context has an argument stat_enable in its new function, but it can be set in other ways and setting it in new is not a good design. However, tls, in other words, whether tls is enabled should not be changed during processing request, so it is better to set it in ClientContext::new.

In addition, in previous codes, we should import volo::context::Context for getting tls and stat_enable, and it is not a good design, too. It requires a getter or setter function.

Solution

  • ServerContext::new(target: Address, stat_enable: bool) -> ServerContext::new(target: Address)
  • ClientContext::new(target: Address, stat_enable: bool) -> ClientContext::new(target: Address, tls: bool)
  • Add xxxContext::enable_stat, xxxContext::stat_enabled and ClientCxInner::tls

@wfly1998 wfly1998 requested review from a team as code owners March 13, 2024 03:33
Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
@wfly1998 wfly1998 merged commit 0383137 into cloudwego:main Mar 13, 2024
13 checks passed
@wfly1998 wfly1998 deleted the chore/http-refactor-config branch March 13, 2024 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants