1 | /*!
|
2 | * Copyright 2019 Google Inc. All Rights Reserved.
|
3 | *
|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | * you may not use this file except in compliance with the License.
|
6 | * You may obtain a copy of the License at
|
7 | *
|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
9 | *
|
10 | * Unless required by applicable law or agreed to in writing, software
|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | * See the License for the specific language governing permissions and
|
14 | * limitations under the License.
|
15 | */
|
16 | import { grpc } from 'google-gax';
|
17 | /*!
|
18 | * retryable grpc.status codes
|
19 | */
|
20 | export declare const RETRY_CODES: grpc.status[];
|
21 | /**
|
22 | * Used to track pull requests and determine if additional requests should be
|
23 | * made, etc.
|
24 | *
|
25 | * @class
|
26 | * @private
|
27 | */
|
28 | export declare class PullRetry {
|
29 | private failures;
|
30 | /**
|
31 | * Generates a timeout that can be used for applying a backoff based on the
|
32 | * current number of failed requests.
|
33 | *
|
34 | * @see {@link https://cloud.google.com/iot/docs/how-tos/exponential-backoff}
|
35 | * @private
|
36 | * @returns {number}
|
37 | */
|
38 | createTimeout(): number;
|
39 | /**
|
40 | * Determines if a request grpc.status should be retried.
|
41 | *
|
42 | * Deadlines behave kind of unexpectedly on streams, rather than using it as
|
43 | * an indicator of when to give up trying to connect, it actually dictates
|
44 | * how long the stream should stay open. Because of this, it is virtually
|
45 | * impossible to determine whether or not a deadline error is the result of
|
46 | * the server closing the stream or if we timed out waiting for a connection.
|
47 | *
|
48 | * @private
|
49 | * @param {object} grpc.status The request grpc.status.
|
50 | * @returns {boolean}
|
51 | */
|
52 | retry(err: grpc.StatusObject): boolean;
|
53 | }
|