ProcessInterface.php 847 B

123456789101112131415161718192021222324252627282930313233343536
  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\Contract;
  12. use Swoole\Coroutine\Http\Server as CoHttpServer;
  13. use Swoole\Coroutine\Server as CoServer;
  14. use Swoole\Server;
  15. interface ProcessInterface
  16. {
  17. /**
  18. * Create the process object according to process number and bind to server.
  19. * @param CoHttpServer|CoServer|Server $server
  20. */
  21. public function bind($server): void;
  22. /**
  23. * Determine if the process should start ?
  24. * @param CoServer|Server $server
  25. */
  26. public function isEnable($server): bool;
  27. /**
  28. * The logical of process will place in here.
  29. */
  30. public function handle(): void;
  31. }