azure-storage-common\src\Common\Middlewares\RetryMiddlewareFactory.php
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
- 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
Methods
appendBlobRetryDecider(integer $statusCode, boolean $isSecondary) : boolean
Decide if the given status code indicate the request should be retried.
This is for append blob.
Name | Type | Description |
---|---|---|
$statusCode | integer | Status code of the previous request. |
$isSecondary | boolean | Whether the request is sent to secondary endpoint. |
Type | Description |
---|---|
boolean | true if the request should be retried. |
create(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
Create the retry handler for the Guzzle client, according to the given attributes.
Name | Type | Description |
---|---|---|
$type | string | 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 |
$numberOfRetries | integer | The maximum number of retries. |
$interval | integer | The minimum interval between each retry |
$accumulationMethod | string | If the interval increases linearly or exponentially. Possible value can be self::LINEAR_INTERVAL_ACCUMULATION or self::EXPONENTIAL_INTERVAL_ACCUMULATION |
$retryConnect | boolean | Whether to retry on connection failures. |
Type | Description |
---|---|
\MicrosoftAzure\Storage\Common\Middlewares\RetryMiddleware | A RetryMiddleware object that contains the logic of how the request should be handled after a response. |
createExponentialDelayCalculator(integer $interval) : callable
Create the delay calculator that increases the interval exponentially according to the number of retries.
Name | Type | Description |
---|---|---|
$interval | integer | the minimum interval of the retry. |
Type | Description |
---|---|
callable | a calculator that will return the interval according to the number of retries. |
createLinearDelayCalculator(integer $interval) : callable
Create the delay calculator that increases the interval linearly according to the number of retries.
Name | Type | Description |
---|---|---|
$interval | integer | the minimum interval of the retry. |
Type | Description |
---|---|
callable | a calculator that will return the interval according to the number of retries. |
createRetryDecider(string $type, integer $maxRetries, boolean $retryConnect) : callable
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.
Name | Type | Description |
---|---|---|
$type | string | The type of the retry handler. |
$maxRetries | integer | The maximum number of retries to be done. |
$retryConnect | boolean | Whether to retry on connection failures. |
Type | Description |
---|---|
callable | The callable that will return if the request should be retried. |
generalRetryDecider(integer $statusCode, boolean $isSecondary) : boolean
Decide if the given status code indicate the request should be retried.
Name | Type | Description |
---|---|---|
$statusCode | integer | Status code of the previous request. |
$isSecondary | boolean | Whether the request is sent to secondary endpoint. |
Type | Description |
---|---|
boolean | true if the request should be retried. |