Файл: includes/library/aws/Aws/DynamoDb/DynamoDbClient.php
Строк: 78
<?php
namespace AwsDynamoDb;
use AwsApiParserCrc32ValidatingParser;
use AwsAwsClient;
use AwsClientResolver;
use AwsHandlerList;
use AwsMiddleware;
use AwsRetryMiddleware;
/**
* This client is used to interact with the **Amazon DynamoDB** service.
*/
class DynamoDbClient extends AwsClient
{
public static function getArguments()
{
$args = parent::getArguments();
$args['retries']['default'] = 11;
$args['retries']['fn'] = [__CLASS__, '_applyRetryConfig'];
$args['api_provider']['fn'] = [__CLASS__, '_applyApiProvider'];
return $args;
}
/**
* Convenience method for instantiating and registering the DynamoDB
* Session handler with this DynamoDB client object.
*
* @param array $config Array of options for the session handler factory
*
* @return SessionHandler
*/
public function registerSessionHandler(array $config = [])
{
$handler = SessionHandler::fromClient($this, $config);
$handler->register();
return $handler;
}
/** @internal */
public static function _applyRetryConfig($value, array &$args, HandlerList $list)
{
if (!$value) {
return;
}
$list->appendSign(
Middleware::retry(
RetryMiddleware::createDefaultDecider($value),
function ($retries) {
return $retries
? (50 * (int) pow(2, $retries - 1)) / 1000
: 0;
}
),
'retry'
);
}
/** @internal */
public static function _applyApiProvider($value, array &$args, HandlerList $list)
{
ClientResolver::_apply_api_provider($value, $args, $list);
$args['parser'] = new Crc32ValidatingParser($args['parser']);
}
}