-
Notifications
You must be signed in to change notification settings - Fork 451
Add options for entity calls in DatastoreSessionHandler #620
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
Conversation
|
Thanks for doing this, however, I think we can safely add this behavior, even it's strictly a BC-break, because the session data is not meant to be indexed as a string in any way. How about to just automatically add the option under the cover? |
| /** | ||
| * Write the session data to Cloud Datastore. | ||
| * | ||
| * @param string $id Identifier used to construct a {@see Key} for the {@see Entity} to be written. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@tmatsuo Interesting. I feel like I am not familiar enough to understand whether any of our users might be depending on the current behaviour. If the chances are negligible or zero, then I agree that making this the default makes sense, but I do think that we need to be very careful about making such decisions in our GA APIs. @jdpedrie @dwsupplee WDYT? |
|
@michaelbausor I would say it's negligible, very close to zero |
|
@michaelbausor the tests are failing all over at the moment, we're looking into it. but you do have a couple of code sniffer issues which can be addressed in the meanwhile: https://travis-ci.org/GoogleCloudPlatform/google-cloud-php/jobs/262396218#L841
|
I agree wholeheartedly with this. @tmatsuo, it seems this may be something we want to classify as a bug, WDYT? If that is the case, I am in favor of going ahead and making the fix even if it is technically a BC break. |
|
@dwsupplee Yeah agreed with marking this as a bug. This data should not be indexed by any means. It also causes #506. |
| * @return bool | ||
| */ | ||
| public function write($id, $data) | ||
| public function write($id, $data, $entityOptions = null) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| * | ||
| * @param string $id Identifier used to construct a {@see \Google\Cloud\Datastore\Key} for the {@see \Google\Cloud\Datastore\Entity} to be written. | ||
| * @param string $data The session data to write to the {@see \Google\Cloud\Datastore\Entity}. | ||
| * @param array $entityOptions Optional arguments that will be passed to the {@see \Google\Cloud\Datastore\DatastoreClient::entity} method |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| DatastoreClient $datastore, | ||
| $gcLimit = self::DEFAULT_GC_LIMIT | ||
| $gcLimit = self::DEFAULT_GC_LIMIT, | ||
| $options = [] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
|
(merged in the travis grpc fix) |
|
I have changed the default behaviour to specify |
|
@jdpedrie Thanks for merging in the Travis fix. It looks like there are some other changes in this PR now as well - does that mean this PR should wait until those are in master? |
|
@michaelbausor sorry about that! Weird. It appears that the other changes are from #617. But that PR was already merged, so I'm not sure why they are showing up in the diff. I don't want to mess any more with your PR, so I won't change anything, but you could drop that commit: Change Again, sorry for the mess! |
|
@jdpedrie No worries, fixed! |
dwsupplee
left a comment
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.
Looks great!
tmatsuo
left a comment
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.
LG! Thanks!
jdpedrie
left a comment
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.
just a couple tiny things, otherwise lg!
| * | ||
| * @type array $entityOptions Default options to be passed to the | ||
| * {@see \Google\Cloud\Datastore\DatastoreClient::entity()} method when writing session data to Datastore. | ||
| * If not specified, defaults to ['excludeFromIndexes' => ['data']]. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| // Cut down to 1000 | ||
| $this->gcLimit = min($gcLimit, 1000); | ||
|
|
||
| if (!isset($options['entityOptions'])) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
PTAL |
jdpedrie
left a comment
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.
LGTM
|
@michaelbausor a couple of phpcs issues: https://travis-ci.org/GoogleCloudPlatform/google-cloud-php/jobs/263629165#L2710 |
|
Thanks - fixed |
Fixes #506
cc @tmatsuo @dwsupplee @jdpedrie
Some notes: