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

feat: make sdk.Context implement context.Context #10941

Merged
merged 5 commits into from
Jan 19, 2022

Conversation

aaronc
Copy link
Member

@aaronc aaronc commented Jan 12, 2022

Description

This:

  • addresses an issue with the way WrapSDKContext was done in that it doesn't use the context.Context that is already inside sdk.Context
  • it allows sdk.Context to be used as a context.Context directly
  • it also walks back the deprecation of Value and WithValue from Simplify context #4706 as I actually think these are useful, and trying to put everything directly into Context as a bag of variables rather than attaching it using something like WithValue makes the SDK less extensible

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Copy link
Contributor

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

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

LGTM seems good to merge.

Should there be comments on the Deadline, Done, Err functions explaining that they are there for interface matching, and just pass through to the underlying ctx key value store?

Also as an aside can c.ctx be renamed to c.additional_data or something? I was pretty confused by the c.ctx on first pass 😅

(Neither of those comments really matter imo, and don't block merge)

Copy link
Collaborator

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

utACK

@robert-zaremba
Copy link
Collaborator

can c.ctx be renamed to c.additional_data or something?

c.ctx was already there. it's the "go stdlib" context. It's private member, so IMHO, not a big deal, but I'm not against renaming eg to stdctx if this makes confusions.

@blushi
Copy link
Contributor

blushi commented Jan 18, 2022

can c.ctx be renamed to c.additional_data or something?

c.ctx was already there. it's the "go stdlib" context. It's private member, so IMHO, not a big deal, but I'm not against renaming eg to stdctx if this makes confusions.

@aaronc ping

@aaronc
Copy link
Member Author

aaronc commented Jan 19, 2022

can c.ctx be renamed to c.additional_data or something?

c.ctx was already there. it's the "go stdlib" context. It's private member, so IMHO, not a big deal, but I'm not against renaming eg to stdctx if this makes confusions.

@aaronc ping

I renamed it to baseCtx which I think is the role it plays

@aaronc aaronc added the A:automerge Automatically merge PR once all prerequisites pass. label Jan 19, 2022
@mergify mergify bot merged commit cff9e9a into master Jan 19, 2022
@mergify mergify bot deleted the aaronc/update-sdk-context branch January 19, 2022 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants