-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add pipelining #99
Comments
I reverted added pipelining because the implementation wasn't very good. I'm still in the process of thinking how to do it properly. Currently I'm working on branch https://github.com/neo4j-php/Bolt/tree/traits_pipeline where I did some interesting changes in approach. you can do this: $res = iterator_to_array(
$protocol
->begin()
->run('CREATE (a:Test) RETURN a, ID(a)')
->pull()
->rollback()
->getResponse()
); Variable $res will be array with this indexes and context:
You can chain all methods beside hello and goodbye. Reading data from database output buffer is continuously and getResponse is using yield for every readed message from buffer. Also getResponse has parameter limit which you can use to limit how many messages to read from buffer (maybe also add skip?). Any ideas or feedback? |
Added new Removed throwing MessageException and IgnoredException because handling of these can be based on Response instance in implementation of this library. Changed protocol method for reading response, now it has two methods: Usage with getResponse $protocol
->run('RETURN 1 AS num')
->pull();
$runResponse = $protocol->getResponse(); // \Bolt\protocol\Response(RUN, SUCCESS, [content])
$pullRecord = $protocol->getResponse(); // \Bolt\protocol\Response(PULL, RECORD, [content])
$pullMeta = $protocol->getResponse(); // \Bolt\protocol\Response(PULL, SUCCESS, [content]) Usage with getResponses $gen = $protocol
->run('RETURN 1 AS num')
->pull()
->getResponses();
foreach ($gen as $response) {
// logic
} |
Add support for pipelining bolt messages https://www.neo4j.com/docs/bolt/current/bolt/message/#pipelining
Messages may also be pipelined. In other words, clients may send multiple requests eagerly without first waiting for responses. When a failure occurs in this scenario, servers must ignore all subsequent requests until the client has explicitly acknowledged receipt of the failure. This prevents inadvertent execution of queries that may not be valid. More details of this process can be found in the sections below.
The text was updated successfully, but these errors were encountered: