Class Brightzone\GremlinDriver\Workload

InheritanceBrightzone\GremlinDriver\Workload

Gremlin-server PHP Driver client Workload class

Workload class will store some executable code and run it against the database. It also allows for fail-retry strategies in the event of concurrency errors

$workload = new Workload(function(&$db, $msg, $processor, $op, $args){
         return $db->send($msg, $processor, $op, $args);
     },
     [&$this, $msg, $processor, $op, $args]
);

$response = $workload->linearRetry($this->retryAttempts);

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$callback \Brightzone\GremlinDriver\the Callback code to be executed Bellow is a common example: ~~~ function(&db, $msg, $processor, $op, $processor, $args){} ~~~ It must return something other than void. Brightzone\GremlinDriver\Workload
$params \Brightzone\GremlinDriver\paramteres Required for the workload Ideas of params would be : - Connection &db connection object to operate on - Message $msg possible message to operate on (optional defaults to NULL) - String $processor processor to use (optional defaults to "") - String $op operation to perform (optional defaults to "eval") - array $args arguments for the message. Brightzone\GremlinDriver\Workload

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Override Constructor Brightzone\GremlinDriver\Workload
linearRetry() Linear retry strategy. Brightzone\GremlinDriver\Workload

Property Details

$callback protected property

Callback code to be executed Bellow is a common example: ~~~ function(&db, $msg, $processor, $op, $processor, $args){} ~~~ It must return something other than void. (the desired result)

protected \Brightzone\GremlinDriver\the $callback null
$params protected property

Required for the workload

Ideas of params would be :

  • Connection &db connection object to operate on
  • Message $msg possible message to operate on (optional defaults to NULL)
  • String $processor processor to use (optional defaults to "")
  • String $op operation to perform (optional defaults to "eval")
  • array $args arguments for the message. (optional defaults to [])
protected \Brightzone\GremlinDriver\paramteres $params null

Method Details

__construct() public method

Override Constructor

public void __construct ( callable $callback, $params )
$callback callable

The portion of code to execute within the scope of this workload

$params array

The paramters to pass to the callback.

linearRetry() public method

Linear retry strategy.

public \Brightzone\GremlinDriver\the linearRetry ( $attempts )
$attempts int

The number of times to retry

return \Brightzone\GremlinDriver\the

Result of the executable code