1
0
mirror of https://github.com/danog/parallel.git synced 2024-12-02 17:52:14 +01:00
parallel/src/Worker/Pool.php

47 lines
1023 B
PHP
Raw Normal View History

<?php
namespace Icicle\Concurrent\Worker;
/**
2015-12-05 06:50:32 +01:00
* An interface for worker pools.
*/
2015-12-05 06:50:32 +01:00
interface Pool extends Worker
{
2015-12-16 22:53:53 +01:00
/**
* @var int The default minimum pool size.
*/
const DEFAULT_MIN_SIZE = 4;
/**
* @var int The default maximum pool size.
*/
const DEFAULT_MAX_SIZE = 32;
2015-08-29 03:30:53 +02:00
/**
2015-12-05 06:50:32 +01:00
* Gets the number of workers currently running in the pool.
*
2015-12-05 06:50:32 +01:00
* @return int The number of workers.
*/
2015-12-05 06:50:32 +01:00
public function getWorkerCount();
/**
2015-12-05 06:50:32 +01:00
* Gets the number of workers that are currently idle.
*
2015-12-05 06:50:32 +01:00
* @return int The number of idle workers.
*/
2015-12-05 06:50:32 +01:00
public function getIdleWorkerCount();
2015-12-16 22:53:53 +01:00
/**
* Gets the minimum number of workers the pool may have idle.
*
* @return int The minimum number of workers.
*/
public function getMinSize();
/**
* Gets the maximum number of workers the pool may spawn to handle concurrent tasks.
*
* @return int The maximum number of workers.
*/
public function getMaxSize();
}