diff --git a/src/Task.php b/src/Task.php deleted file mode 100644 index a607d90..0000000 --- a/src/Task.php +++ /dev/null @@ -1,25 +0,0 @@ -task = $task; - } - - /** - * Runs the task inside the caller's context. - * - * @return [type] [description] - */ - public function runHere() - { - call_user_func($this->task); - } -} diff --git a/src/Worker/TaskInterface.php b/src/Worker/TaskInterface.php new file mode 100644 index 0000000..06cbf06 --- /dev/null +++ b/src/Worker/TaskInterface.php @@ -0,0 +1,15 @@ +minSize = $minSize; + + if ($maxSize === null) { + $this->maxSize = $minSize; + } elseif (!is_int($maxSize) || $maxSize < 0) { + throw new InvalidArgumentError('Maximum size must be a non-negative integer.'); + } else { + $this->maxSize = $maxSize; + } + } + + public function getMinSize() + { + return $this->minSize; + } + + public function getMaxSize() + { + return $this->maxSize; + } + + /** + * Gets the number of workers that have been spawned. + * + * @return int + */ + public function getWorkerCount() + { + } + + /** + * Gets the number of workers that are currently idle. + * + * @return int + */ + public function getIdleWorkerCount() + { + } + + /** + * Enqueues a task to be executed in the worker pool. + * + * @param TaskInterface $task The task to execute. + * + * @return \Icicle\Promise\PromiseInterface + */ + public function enqueue(TaskInterface $task) + { + } +}