session: rename and unify location of interfaces, and some refactor#62498
Conversation
|
Hi @D3Hunter. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #62498 +/- ##
================================================
+ Coverage 72.8290% 75.2744% +2.4454%
================================================
Files 1760 1808 +48
Lines 485971 498129 +12158
================================================
+ Hits 353928 374964 +21036
+ Misses 110406 100131 -10275
- Partials 21637 23034 +1397
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
da72bd0 to
13a3895
Compare
| func (e *ShowExec) fetchShowSessionStates(ctx context.Context) error { | ||
| sessionStates := &sessionstates.SessionStates{} | ||
| err := e.Ctx().EncodeSessionStates(ctx, e.Ctx(), sessionStates) | ||
| err := e.Ctx().EncodeStates(ctx, sessionStates) |
There was a problem hiding this comment.
we separate the main caller, *session.session, and the handlers, such as TiDBContext and sessionBindingHandle
| return errors.Trace(err) | ||
| } | ||
| return e.Ctx().DecodeSessionStates(ctx, e.Ctx(), &sessionStates) | ||
| return e.Ctx().DecodeStates(ctx, &sessionStates) |
| EncodeStates(context.Context, *sessionstates.SessionStates) error | ||
| // DecodeStates decodes a map into session states. | ||
| DecodeStates(context.Context, *sessionstates.SessionStates) error |
There was a problem hiding this comment.
those 2 are added to difference with SessionStatesHandler
| type Context interface { | ||
| SessionStatesHandler | ||
| contextutil.ValueStoreContext | ||
| planctx.Common |
There was a problem hiding this comment.
Do we need planctx.Common here? A user can call Context. GetPlanCtx()
There was a problem hiding this comment.
sessionctx.Context need those API defined in planctx.Common which are shared with PlanCtx, i just unify the definition of those APIs
[LGTM Timeline notifier]Timeline:
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hawkingrei, lcwangchao, Leavrth, tangenta, yudongusa The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: ref #61702
Problem Summary:
What changed and how does it work?
session/typespkg assession/sessionapi,typesis not a good name to describe what it doesplanctx.PlanContextandsessionctx.Context. previously, if I want to add a API to both of them, i have to edit 2 place.sessionctx.ContextandSessionStatesHandler,sessionctx.Contextis for calling related handlers, but itself is not one of them.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.