Свойство | Тип | Описание | |
---|---|---|---|
$credentials | Disque\Connection\Credentials[] | After connecting to one, the server returns a list of other nodes in the cluster so we can connect to them automatically, unless the discovered nodes are secured with a password. 'serverAddress' => Credentials | |
$nodeId | string | The ID of the node we are currently connected to | |
$nodePrefixes | array | Node prefix consists of the first 8 bytes from the node ID. Because job IDs contain the node prefix, it can be used to identify on which node a job lives. 'nodePrefix' => 'nodeId' | |
$nodes | 'nodeId' => Node | ||
$priorityStrategy | Disque\Connection\Node\NodePrioritizerInterface | The default strategy is the ConservativeJobCountPrioritizer. It prioritizes nodes by their job count, but prefers the current node in order to avoid switching until there is a clearly better node. |
Метод | Описание | |
---|---|---|
__construct ( ) | ||
addServer ( Disque\Connection\Credentials $credentials ) | ||
connect ( ) | ||
execute ( Disque\Command\CommandInterface $command ) | ||
getConnectionFactory ( ) | ||
getCredentials ( ) | ||
getCurrentNode ( ) | ||
getPriorityStrategy ( ) | ||
isConnected ( ) | ||
setConnectionFactory ( Disque\Connection\Factory\ConnectionFactoryInterface $connectionFactory ) | ||
setPriorityStrategy ( Disque\Connection\Node\NodePrioritizerInterface $priorityStrategy ) |
Метод | Описание | |
---|---|---|
findAvailableConnection ( ) : |
Get a functional connection to any known node | |
getNodeConnection ( Disque\Connection\Credentials $server ) : |
Connect to the node given in the credentials | |
postprocessExecution ( Disque\Command\CommandInterface $command, mixed $response ) : mixed | Postprocess the command execution, eg. update node stats | |
preprocessExecution ( Disque\Command\CommandInterface $command ) : Disque\Command\CommandInterface | Hook into the command execution and do anything before it's executed | |
resetNodeCounters ( ) | Reset node counters that should be reset upon node switch | |
updateNodeStats ( array $jobs ) | Update node counters indicating how many jobs the node has produced |
Метод | Описание | |
---|---|---|
copyNodeStats ( |
Copy node stats from the old to the new node | |
createNode ( Disque\Connection\Credentials $credentials ) : |
Create a new Node object | |
getNodeIdFromJobId ( string $jobId ) : string | null | Get a node ID based off a Job ID | |
getNodePrefixFromJobId ( string $jobId ) : string | Get the node prefix from the job ID | |
revealClusterFromHello ( |
Reveal the whole Disque cluster from a node HELLO response | |
revealNodeFromHello ( string $nodeId, array $node ) : |
Reveal a single node from a HELLO response, or use an existing node | |
shouldBeConnected ( ) : void | We should be connected | |
switchNodeIfNeeded ( ) | Decide if we should switch to a better node | |
switchToNode ( |
Switch to the given node and map the cluster from its HELLO | |
wasAlreadyConnected ( ) : boolean | Check if the manager held a connection to Disque already |
public addServer ( Disque\Connection\Credentials $credentials ) | ||
$credentials | Disque\Connection\Credentials |
public execute ( Disque\Command\CommandInterface $command ) | ||
$command | Disque\Command\CommandInterface |
protected findAvailableConnection ( ) : |
||
Результат | A connected node |
protected getNodeConnection ( Disque\Connection\Credentials $server ) : |
||
$server | Disque\Connection\Credentials | |
Результат | A connected node |
protected postprocessExecution ( Disque\Command\CommandInterface $command, mixed $response ) : mixed | ||
$command | Disque\Command\CommandInterface | |
$response | mixed | |
Результат | mixed |
protected preprocessExecution ( Disque\Command\CommandInterface $command ) : Disque\Command\CommandInterface | ||
$command | Disque\Command\CommandInterface | |
Результат | Disque\Command\CommandInterface | $command |
protected resetNodeCounters ( ) |
public setConnectionFactory ( Disque\Connection\Factory\ConnectionFactoryInterface $connectionFactory ) | ||
$connectionFactory | Disque\Connection\Factory\ConnectionFactoryInterface |
public setPriorityStrategy ( Disque\Connection\Node\NodePrioritizerInterface $priorityStrategy ) | ||
$priorityStrategy | Disque\Connection\Node\NodePrioritizerInterface |
protected updateNodeStats ( array $jobs ) | ||
$jobs | array | Jobs |
protected Credentials[],Disque\Connection $credentials | ||
Результат | Disque\Connection\Credentials[] |
protected string $nodeId | ||
Результат | string |
protected array $nodePrefixes | ||
Результат | array |
protected Node[],Disque\Connection\Node $nodes | ||
Результат |
protected NodePrioritizerInterface,Disque\Connection\Node $priorityStrategy | ||
Результат | Disque\Connection\Node\NodePrioritizerInterface |