DriverInterface.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. namespace Hyperf\ServiceGovernance;
  12. use JetBrains\PhpStorm\ArrayShape;
  13. interface DriverInterface
  14. {
  15. /**
  16. * @return array = [['host' => '127.0.0.1', 'port' => 9501]]
  17. */
  18. public function getNodes(
  19. string $uri,
  20. string $name,
  21. #[ArrayShape([
  22. 'protocol' => 'string',
  23. 'nodes' => [
  24. [
  25. 'host' => 'string',
  26. 'port' => 'int',
  27. 'weight' => 'int',
  28. ],
  29. ],
  30. ])]
  31. array $metadata
  32. ): array;
  33. public function isLongPolling(): bool;
  34. public function register(
  35. string $name,
  36. string $host,
  37. int $port,
  38. #[ArrayShape([
  39. 'protocol' => 'string',
  40. ])]
  41. array $metadata
  42. ): void;
  43. public function isRegistered(
  44. string $name,
  45. string $host,
  46. int $port,
  47. #[ArrayShape([
  48. 'protocol' => 'string',
  49. ])]
  50. array $metadata
  51. ): bool;
  52. }