-
Notifications
You must be signed in to change notification settings - Fork 24
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
Support call 17 #167
Support call 17 #167
Conversation
0f9b6d2
to
f9b7480
Compare
f9b7480
to
e5d21cd
Compare
I have big doubts about the chosen API. The new method allows to mutate the internal state of an already instantiated Btw, I raised the same questions about the global |
@rybakit Are you have an API proposal in the mind that we can discuss? In an offline discussion @LeonidVas said that he doesn't want to obligate a user to pass all constructor arguments (possibly I looked at the links from #75 and, yep, we can provide an alternative way to configure settings: accept a map ( So if you have thoughts how to better do it, please, share it with us. |
My point: |
This sounds reasonable in theory but I think you overestimate the usefulness of this feature in practice. Tarantool 1.6 is EOLed long ago and by introducing this new method you'll just increase the migration cost for the current and even future users of this connector. It's better to be a bit less flexible now regarding this questionable feature, rather than continuing to increase the technical debt for no reason. And we are not talking about days of refactoring here, updating call16 to call17 is so minor change that it will take less than an hour to fix even a very large codebase. If users are not ready to migrate to the new version of the connector, the old one will still remain, it will not suddenly disappear with a new release :) For my connector, I dropped call16 3 years ago (!), and in all this time I only had a question about it once, and the guy was happy to use the old version of the library until they migrate to a newer tarantol/php stack. Moreover, it's not clear what is the release policy for this connector, is it stable already and no BC breaks are allowed or does the major
I'm in favor of an associative array (map) of the configuration options as a constructor argument. It will keep object immutable, solve the other issue with the global ini settings, and make it easier to extend the connector in the future (e.g. by adding support for the new error format). Don't know if it needs to be spitted or not, I didn't dive that deep, maybe ask real users of this connector? P.S.
Please keep the argument position consistent, no magic with "any argument at any position", it will only confuse users. If it will help you, in my connector I use "named constructors" (static factory methods) along with the regular constructor, so users are free to choose how to instantiate the client - create it via |
So, either mixed first argument in a constructor or a static method to construct from an option map. The latter looks more strict, I would prefer this way. Thanks! NB: Hm, can we do something with I think we can technically resolve #101 with a Example of API for $c = new Tarantool('localhost', 3301);
$c->call(foo, [1, 2, 3], array('call_16' => false)); |
In my tarantool client the
If you decide to implement this, then consider just using a boolean flag: $c->call('foo', [1, 2, 3]); // call16
$c->call('foo', [1, 2, 3], false); // call16
$c->call('foo', [1, 2, 3], true); // call17 Or do you think |
I want to left the ability to add more, yes. |
e5d21cd
to
3c2b4bf
Compare
Hmm, yep. If we go this way, it should be something like |
I added options to call(). |
15f563f
to
b4a0352
Compare
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 feel myself almost comfortable with the PR. Only option name (call_16
vs call_17
) disquiets me. I would discuss it (see the relevant comment below): not because your way is not right, but to deduce some general rule for myself and apply it in the future.
b4a0352
to
9733a34
Compare
Since you decided to add call16 support as an option argument to |
It will override the constructor's option (force call_16 or call_17 mode only for this call). |
* Added support for a new binary protocol command for "call" (used since tarantool 1.7.2). Unlike the old version, returned data is not converted to tuples (like in case of using "eval"). Default - call_16 mode. * Added options to "call" method. It can be used to force call_16 / call_17 mode. Example: ``` php $c = new Tarantool('localhost', 3301); $c->connect(); $c->call("test_call", array(), array('call_16' => false)); $c->close(); ``` Closes #101
9733a34
to
389e87f
Compare
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.
BTW, should not we update tarantool-php-stubs? |
@Totktonada Yep. And also consider proposing them to https://github.com/JetBrains/phpstorm-stubs. |
Thanks! Filed https://github.com/tarantool/tarantool-php-stubs/issues/2 and https://github.com/tarantool/tarantool-php-stubs/issues/3 to don't forget about this. |
In some places, the tarantool code style has been broken to better match the file code style.
Closes #101
ChangeLog: added support of a new binary protocol command for "call"(call_17 mode since tarantool 1.7.2, returned data has an arbitrary structure).