azure-storage-common\src\Common\Middlewares\RetryMiddlewareFactory.php

Show: PublicProtectedPrivateinherited
Table of Contents
LICENSE: The MIT License (the "License") you may not use this file except in compliance with the License.

You may obtain a copy of the License at https://github.com/azure/azure-storage-php/LICENSE

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

PHP version 5

Author
Azure Storage PHP SDK  
Category
Microsoft  
Copyright
2016 Microsoft Corporation  
License
https://github.com/azure/azure-storage-php/LICENSE  
Link
https://github.com/azure/azure-storage-php  
Package
MicrosoftAzure\Storage\Common\Middlewares  

\MicrosoftAzure\Storage\Common\Middlewares\RetryMiddlewareFactory

Package: MicrosoftAzure\Storage\Common\Middlewares
This class provides static functions that creates retry handlers for Guzzle HTTP clients to handle retry policy.
Author
Azure Storage PHP SDK  
Category
Microsoft  
Copyright
2016 Microsoft Corporation  
License
https://github.com/azure/azure-storage-php/LICENSE  
Link
https://github.com/azure/azure-storage-php  

Constants

>VConstant  LINEAR_INTERVAL_ACCUMULATION = 'Linear'
>VConstant  EXPONENTIAL_INTERVAL_ACCUMULATION = 'Exponential'
>VConstant  GENERAL_RETRY_TYPE = 'General'
>VConstant  APPEND_BLOB_RETRY_TYPE = 'Append Blob Retry'

Methods

methodprotectedappendBlobRetryDecider(integer $statusCode, boolean $isSecondary) : boolean
static

Decide if the given status code indicate the request should be retried.

This is for append blob.

Parameters
NameTypeDescription
$statusCodeinteger

Status code of the previous request.

$isSecondaryboolean

Whether the request is sent to secondary endpoint.

Returns
TypeDescription
booleantrue if the request should be retried.
methodpubliccreate(string $type = self::GENERAL_RETRY_TYPE, integer $numberOfRetries = \MicrosoftAzure\Storage\Common\Internal\Resources::DEFAULT_NUMBER_OF_RETRIES, integer $interval = \MicrosoftAzure\Storage\Common\Internal\Resources::DEFAULT_RETRY_INTERVAL, string $accumulationMethod = self::LINEAR_INTERVAL_ACCUMULATION, boolean $retryConnect = false) : \MicrosoftAzure\Storage\Common\Middlewares\RetryMiddleware
static

Create the retry handler for the Guzzle client, according to the given attributes.

Parameters
NameTypeDescription
$typestring

The type that controls the logic of the decider of the retry handler. Possible value can be self::GENERAL_RETRY_TYPE or self::APPEND_BLOB_RETRY_TYPE

$numberOfRetriesinteger

The maximum number of retries.

$intervalinteger

The minimum interval between each retry

$accumulationMethodstring

If the interval increases linearly or exponentially. Possible value can be self::LINEAR_INTERVAL_ACCUMULATION or self::EXPONENTIAL_INTERVAL_ACCUMULATION

$retryConnectboolean

Whether to retry on connection failures.

Returns
TypeDescription
\MicrosoftAzure\Storage\Common\Middlewares\RetryMiddlewareA RetryMiddleware object that contains the logic of how the request should be handled after a response.
methodprotectedcreateExponentialDelayCalculator(integer $interval) : callable
static

Create the delay calculator that increases the interval exponentially according to the number of retries.

Parameters
NameTypeDescription
$intervalinteger

the minimum interval of the retry.

Returns
TypeDescription
callablea calculator that will return the interval according to the number of retries.
methodprotectedcreateLinearDelayCalculator(integer $interval) : callable
static

Create the delay calculator that increases the interval linearly according to the number of retries.

Parameters
NameTypeDescription
$intervalinteger

the minimum interval of the retry.

Returns
TypeDescription
callablea calculator that will return the interval according to the number of retries.
methodprotectedcreateRetryDecider(string $type, integer $maxRetries, boolean $retryConnect) : callable
static

Create the retry decider for the retry handler. It will return a callable that accepts the number of retries, the request, the response and the exception, and return the decision for a retry.

Parameters
NameTypeDescription
$typestring

The type of the retry handler.

$maxRetriesinteger

The maximum number of retries to be done.

$retryConnectboolean

Whether to retry on connection failures.

Returns
TypeDescription
callableThe callable that will return if the request should be retried.
methodprotectedgeneralRetryDecider(integer $statusCode, boolean $isSecondary) : boolean
static

Decide if the given status code indicate the request should be retried.

Parameters
NameTypeDescription
$statusCodeinteger

Status code of the previous request.

$isSecondaryboolean

Whether the request is sent to secondary endpoint.

Returns
TypeDescription
booleantrue if the request should be retried.
Documentation was generated by phpDocumentor 2.9.1.