Свойство | Type | Description | |
---|---|---|---|
$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. |
Méthode | Description | |
---|---|---|
__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 ) |
Méthode | Description | |
---|---|---|
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 |
Méthode | Description | |
---|---|---|
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 ( ) : |
||
Résultat | A connected node |
protected getNodeConnection ( Disque\Connection\Credentials $server ) : |
||
$server | Disque\Connection\Credentials | |
Résultat | A connected node |
protected postprocessExecution ( Disque\Command\CommandInterface $command, mixed $response ) : mixed | ||
$command | Disque\Command\CommandInterface | |
$response | mixed | |
Résultat | mixed |
protected preprocessExecution ( Disque\Command\CommandInterface $command ) : Disque\Command\CommandInterface | ||
$command | Disque\Command\CommandInterface | |
Résultat | 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 | ||
Résultat | Disque\Connection\Credentials[] |
protected string $nodeId | ||
Résultat | string |
protected array $nodePrefixes | ||
Résultat | array |
protected Node[],Disque\Connection\Node $nodes | ||
Résultat |
protected NodePrioritizerInterface,Disque\Connection\Node $priorityStrategy | ||
Résultat | Disque\Connection\Node\NodePrioritizerInterface |