-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added support for 5.4. Missing tests because Neo4j 5.13 not available yet. * Uncommented new version for compatibility * Added new message
- Loading branch information
1 parent
774bc9a
commit 9ea1b55
Showing
15 changed files
with
123 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Bolt\protocol; | ||
|
||
/** | ||
* Class Protocol version 5.4 | ||
* | ||
* @author Michal Stefanak | ||
* @link https://github.com/neo4j-php/Bolt | ||
* @see https://www.neo4j.com/docs/bolt/current/bolt/message/ | ||
* @package Bolt\protocol | ||
*/ | ||
class V5_4 extends AProtocol | ||
{ | ||
use \Bolt\protocol\v5\AvailableStructures; | ||
|
||
use \Bolt\protocol\v1\ResetMessage; | ||
|
||
use \Bolt\protocol\v3\RunMessage; | ||
use \Bolt\protocol\v3\BeginMessage; | ||
use \Bolt\protocol\v3\CommitMessage; | ||
use \Bolt\protocol\v3\RollbackMessage; | ||
use \Bolt\protocol\v3\GoodbyeMessage; | ||
|
||
use \Bolt\protocol\v4\PullMessage; | ||
use \Bolt\protocol\v4\DiscardMessage; | ||
|
||
use \Bolt\protocol\v4_4\RouteMessage; | ||
|
||
use \Bolt\protocol\v5_1\LogonMessage; | ||
use \Bolt\protocol\v5_1\LogoffMessage; | ||
|
||
use \Bolt\protocol\v5_3\HelloMessage; | ||
|
||
use \Bolt\protocol\v5_4\TelemetryMessage; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Bolt\protocol\v5_4; | ||
|
||
use Bolt\error\BoltException; | ||
use Bolt\protocol\Response; | ||
use Bolt\protocol\ServerState; | ||
|
||
trait TelemetryMessage | ||
{ | ||
/** | ||
* Send TELEMETRY message | ||
* The TELEMETRY message contains an integer representing which driver API was used. | ||
* | ||
* @link https://neo4j.com/docs/bolt/current/bolt/message/#messages-telemetry | ||
* @param int $api | ||
* @return Response | ||
* @throws BoltException | ||
*/ | ||
public function telemetry(int $api): Response | ||
{ | ||
$this->write($this->packer->pack(0x54, $api)); | ||
$content = $this->read($signature); | ||
|
||
if ($signature === Response::SIGNATURE_FAILURE) { | ||
$this->serverState->set(ServerState::FAILED); | ||
} | ||
|
||
return new Response(Response::MESSAGE_TELEMETRY, $signature, $content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Bolt\protocol\Response; | ||
use Bolt\protocol\ServerState; | ||
use Bolt\protocol\V5_4; | ||
|
||
/** | ||
* Class V5_4Test | ||
* | ||
* @author Michal Stefanak | ||
* @link https://github.com/neo4j-php/Bolt | ||
* @package Bolt\tests\protocol | ||
*/ | ||
class V5_4Test extends \Bolt\tests\protocol\ATest | ||
{ | ||
public function test__construct(): V5_4 | ||
{ | ||
$cls = new V5_4(1, $this->mockConnection(), new \Bolt\protocol\ServerState()); | ||
$this->assertInstanceOf(V5_4::class, $cls); | ||
$cls->serverState->expectedServerStateMismatchCallback = function (string $current, array $expected) { | ||
$this->markTestIncomplete('Server in ' . $current . ' state. Expected ' . implode(' or ', $expected) . '.'); | ||
}; | ||
return $cls; | ||
} | ||
|
||
/** | ||
* @depends test__construct | ||
*/ | ||
public function testTelemetry(V5_4 $cls): void | ||
{ | ||
// todo | ||
} | ||
} |