Manager.php
PHP version 5.1.0+
LICENSE: This source file is subject to the New BSD license that is available through the world-wide-web at the following URI: http://www.opensource.org/licenses/bsd-license.php. If you did not receive a copy of the New BSD License and are unable to obtain it through the web, please send a note to license@php.net so we can mail you a copy immediately.
- Author
- Joe Stump
- Category
- Net
- Copyright
- 2007-2008 Digg.com, Inc.
- License
- New BSD License
- Link
- http://pear.php.net/package/Net_Gearman
- Link
- http://www.danga.com/gearman/
- Package
- ShSo\Net\Gearman
- Version
- CVS: $Id$
\ShSo\Net\Gearman\Manager
This class implements the administrative text protocol used by Gearman to do a number of administrative tasks such as collecting stats on workers, the queue, shutting down the server, version, etc.
- Author
- Joe Stump
- Category
- Net
- Copyright
- 2007-2008 Digg.com, Inc.
- License
- New BSD License
- Link
- http://www.danga.com/gearman/
- Version
- Release: @package_version@
Properties
Methods

checkForError(string $data) : voidCheck for an error
Gearman returns errors in the format of 'ERR code_here Message+here'. This method checks returned values from the server for this error format and will throw the appropriate exception.
| Name | Type | Description |
|---|---|---|
| $data | string | The returned data to check for an error |
| Exception | Description |
|---|---|
| \ShSo\Net\Gearman\ShSo\Net\Gearman\Exception |

recvCommand() : stringReceive a response
For most commands Gearman returns a bunch of lines and ends the transmission of data with a single line of ".\n". This command reads in everything until ".\n". If the command being sent is NOT ended with ".\n" DO NOT use this command.
| Type | Description |
|---|---|
| string |
| Exception | Description |
|---|---|
| \ShSo\Net\Gearman\ShSo\Net\Gearman\Exception |

sendCommand(string $cmd) : voidSend a command
| Name | Type | Description |
|---|---|---|
| $cmd | string | The command to send |
| Exception | Description |
|---|---|
| \ShSo\Net\Gearman\ShSo\Net\Gearman\Exception |

setMaxQueueSize(string $function, integer $size) : booleanSet maximum queue size for a function
For a given function of job, the maximum queue size is adjusted to be max_queue_size jobs long. A negative value indicates unlimited queue size.
If the max_queue_size value is not supplied then it is unset (and the default maximum queue size will apply to this function).
| Name | Type | Description |
|---|---|---|
| $function | string | Name of function to set queue size for |
| $size | integer | New size of queue |
| Type | Description |
|---|---|
| boolean |
| Exception | Description |
|---|---|
| \ShSo\Net\Gearman\ShSo\Net\Gearman\Exception |

status() : arrayGet queue/worker status by function
This function queries for queue status. The array returned is keyed by the function (job) name and has how many jobs are in the queue, how many jobs are running and how many workers are capable of performing that job.
| Type | Description |
|---|---|
| array | An array keyed by function name |
| Exception | Description |
|---|---|
| \ShSo\Net\Gearman\ShSo\Net\Gearman\Exception |